Empty fields notification script on a PDF form
Hi everyone,
I have built a PDF form and I need to put a control script on the Print button so that it checks empty fields right before printing the form.
Pretty easy right? Not exactly...
I have found this nice post from user try67 who proposed a very cool script Re: Check to see if any field is empty
var emptyFields = [];
for (var i=0; i<this.numFields; i++) {
var f= this.getField(this.getNthFieldName(i));
if (f.type!="button" && f.required ) {
if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);
}
}
if (emptyFields.length>0) {
app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));
}
The thing is I need to run the control only on three specific fields of the form, not all of them. I have no idea on how to put this as a script.
Could somebody help me with that?
Thank you in advance.
Xavier
