Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Pop-up warning

Community Beginner ,
Oct 12, 2016 Oct 12, 2016

I have this script that resets an icon via
another button without any warning

var oIconClear = getField("ClearIcon3").buttonGetIcon({nFace:0}); 

getField("Button2").buttonSetIcon({oIcon:oIconClear, nFace: 0}); 


How can I get added to the script a code that gives a warning (yes or no) and who
stops the action when clicked NO

TOPICS
Acrobat SDK and JavaScript , Windows
909
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 13, 2016 Oct 13, 2016

Put the last 2 lines after this.resetForm();

Translate
Community Expert ,
Oct 12, 2016 Oct 12, 2016

You can use the app.alert() method to do that. More information is available in the Acrobat JavaScript API Reference.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 12, 2016 Oct 12, 2016

Hi.

You should read that too: https://acrobatusers.com/tutorials/print/popup_windows_part1


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 12, 2016 Oct 12, 2016

The problem is that I do not manage to get
"App Alert" feature to work with the script over.

It gives a warning but delete icon whether I press yes or no

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2016 Oct 13, 2016

Post the code that you're using.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2016 Oct 13, 2016

// A MouseUp action
// ask question with 'yes/no' take action on 'yes'
if( app.alert({
cMsg: "Do you want to clear this document?", // message to display
cTitle: "Reset Form Warning", // title for pop-up box
nIcon: 2, // question icon
nType: 2 // yes/no buttons
}) == 4) {
this.resetForm();
}

var oIconClear = getField("ClearIcon3").buttonGetIcon({nFace: 0}); 
getField("Button2").buttonSetIcon({oIcon: oIconClear, nFace: 0}); 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2016 Oct 13, 2016

Put the last 2 lines after this.resetForm();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2016 Oct 13, 2016
LATEST

Thanks so much, work perfect

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines