Javascript to suggest requried fields before fillable pdf document will SAVE
I've seen scripts written to show an error when a prospect doesn't fill in all of the required fields. I'd like a SAVE button that will show the empty fields before saving the document. I know I can't override the viewer using the save or save as from the menu.
The one below is working great for me. I'd just like to have code at the end that will SAVE the file if the form is complete. I don't want to use submit. I don't' want the pdf going into an email draft folder.
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")); }
