Copy link to clipboard
Copied
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
Put the last 2 lines after this.resetForm();
Copy link to clipboard
Copied
You can use the app.alert() method to do that. More information is available in the Acrobat JavaScript API Reference.
Copy link to clipboard
Copied
Hi.
You should read that too: https://acrobatusers.com/tutorials/print/popup_windows_part1
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Post the code that you're using.
Copy link to clipboard
Copied
// 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});
Copy link to clipboard
Copied
Put the last 2 lines after this.resetForm();
Copy link to clipboard
Copied
Thanks so much, work perfect
Find more inspiration, events, and resources on the new Adobe Community
Explore Now