Required fields and printing
I have a print button on my form. When you click on it a piece of javascript is executed to list which requried fields have not been filled in. What I want to do is print ONLY if all required fields have been completed.
Thanks
Here is the javascript.
function fnRequired()
{
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"));
}
}