These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Java script in a form - a pop-up menu with yes/no, need the script

Carsten
Registered: Oct 22 2008
Posts: 3
Answered

Hello
I have created a form in Acrobat 9 pro with various fields for the user to plug data into. I have also created a "Reset form" button which works out very good.

But I would at the same time run a java script (an alert) with two options; a "Yes" and a "No" option, a pop-up for this reset button whne you tricker it, just for the user to agree to reset or not. If he push "Yes", the form will reset ...if "No" pressed, the data will stay and the user send back to form again with all data remained.
I already have some of the script ready:

Can somebody help me how to do this and advice the script for this? I would be very happ..have searched the net for days now without help.
I hope to hear from someone here who has the knowledge.

My Product Information:
Acrobat Pro 9.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You want to use the "app.alert" and test the button return value.

// A MouseUp action
var nButton = app.alert({
cMsg: "Caution, all form data will be erased!\nDo you want to continue?",
cTitle: "Caution All Form Data Will Be Erased!",
nIcon: 1, nType: 3
});
// for a 'Yes' response only
if ( nButton == 4 ) this.resetForm();

George Kaiser