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

Example for use of validate handler in execDialog

mibu1mt
Registered: Mar 3 2011
Posts: 17
Answered

Hello,
 
can someone post a quick example of how to use the validate handler in execDialog method? There is no example given in the api examples.
 
I have two simple text inputs, which i want to validate before continuing the script.
 
MfG, Michael

My Product Information:
Acrobat Pro 10.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
For example, you can add this code in the first example given in the reference file, between the initialize and commit sections (the location doesn't really matter, though):

validate: function (dialog) {
var results = dialog.store();
if (results["fnam"]=="" || results["lnam"]=="") {
app.alert("You must enter both names.");
return false;
}
return true;
},

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com