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

yes no button

Judy7108
Registered: Jan 21 2009
Posts: 14

This script checks a field for the value of "10" if it does not equal "10" a message is displayed and "Do you want to continue? The Yes and No button do appear but I don't know how to code the rest. If it does continue it is sent to an email to submit. Right now whether yes or no are checked it goes to the e-mail. I want it to continue if "yes" is chosen and end and drop back to the form for correction if "no" is chosen.

//Get total Days
var nval=this.getField("Day").value;if(nval != 10) {app.alert({cMsg: "Total days do not equal 10, Do you want to continue?", nIcon: 2, nType: 2, cTitle: "Total Days Validation",});}

Here is where I need help i have tried several variations
if (choice==3)end;

Any help is greatly appreciated.

Thanks

My Product Information:
Acrobat Standard 8.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Have you checked the Acrobat JS API Reference to see how to retrieve the response from an alert message? If you want the use this value at a later time than the alert statement you need to collect it in a variable and tested.
console.show();console.clear();//Get total Daysvar nval=this.getField("Day").value;console.println('nval = ' + nval);// test for days not equal to 10if(nval != 10) {// prompt for action to takevar cResponse = app.alert({cMsg: "Total days do not equal 10,Do you want to continue?", nIcon: 2, nType: 2, cTitle: "Total DaysValidation"});} // end if days not equal to 10 // action if days equal 10 or above choice is to continueif(nval == 10 | cResponse == 4){console.println('days = 10 or continue action')} // end if days equal 10 or positive choice to continue has been madeelse {console.println('no action to be taken');} // end of else action

George Kaiser

Judy7108
Registered: Jan 21 2009
Posts: 14
Thanks so much for your answer. I put a 9 in to test and I am getting a script debugger window pops up that says nval = 9 no action to be taken. Also it is still going to the email. I have this code under the mouse down command and the email submit under the mouse up . I am thinking I have that set up wrong or in the wrong order.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
There must be some other action causing the email that you will have to look for. If you have a list of actions under the "Actions" tab they are independent and one action can not stop the action of the other action except by use of a document or global level variable.

The script I provided has no reference to another action than opening the console and displaying some debugging information. If you want this script to control the email, you will need to add the necessary method for the emailing.

George Kaiser