My checkboxes aren't being validated with script even though they are required.
Good morning I am using the script inserted below. And every time I go to save my form with the check boxes it doesn't validate them saying they aren't answered even when required. I'd appreciate any help that can be given.
if (f.type!="button" && f.required && f.display==display.visible) {
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"))
f.strokeColor = color.red; //Highlights the required fields in red
emptyFields.push(f.name);
}
}
if (emptyFields.length>0) {
app.alert("You must fill in the following fields:\n" + emptyFields.join("\n"));
}
else app.execMenuItem("SaveAs");
