Script to highlight empty required fields
Hi, I have button with script to valdiate required fields (fields, boxes, radio). Script showing alert with listed empty fields. I wish if it possible to change colour (fill; background) of fields/radio boxes which is still 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.valueAsString==f.defaultValue) emptyFields.push(f.name);
}
}
if (emptyFields.length>0) {
app.alert({cMsg:"Incomplete! Missing fields:\n" + emptyFields.join("\n"), nIcon:1,});
} else app.alert({cMsg:"All is good", nIcon:4});