Copy link to clipboard
Copied
I have a form with several required fields. When the submit button is clicked and ONE of the required fields is blank an error message is displayed "At least one required field was empty. Please fill in the required fields (highlighted) before continuing". The issue is that ALL of the required fields are highlighted even if they are not blank. Is there a way to highlight just the field(s) that are blank?
Copy link to clipboard
Copied
You can try with a mouse-up event action script like :
// loop through all fields in the document
for ( var i=0; i < this.numFields; i++) {
//get the field names and declare variables
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
/*establish a condition, if the field is not a button type object, and fields are marked as required but the value is empty */
if (f.type != "button" && f.required == true) {
if (f.value == "") {
//trigger an alert for the user to identify which fields are empty
app.alert({
cMsg: "Please complete required field(s) before submitting this form: " + f.name,
cTitle: "Required Fields Check "});
}
}
This is just a very small example of this type of script. You can add more to it.
Copy link to clipboard
Copied
HI @Yvonne33372078ja52 ,
Would you mind sharing the script that you're using? Or better yet, a copy of your PDF (if you can).
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more