Check specific fields aren't empty
I have 13 individual fields on a document that cannot be blank. Due to the way the form is used, I have added a button at the bottom that says 'validate content' and it runs the following when the button is pressed. This works well, but it's obviously checking each field individually and giving separate error messages.
How do I get it to check all 13 fields at once and give the error message as one list of empty fields and mark the fields with a coloured border?
var patternEmpty = /^\s*$/;
var strMissing = "";
if(patternEmpty.test(this.getField("User.USER_EMPLOYEENUMBER").value))
strMissing = "User Employee Number";
else
{ // All is ok, submit the data
console.println("All form data ok");
}
if(strMissing.length)
{// Got an error
app.alert("Missing Form data in field: Code V.1 " + strMissing);
}
var patternEmpty = /^\s*$/;
var strMissing = "";
if(patternEmpty.test(this.getField("O.aff").value))
strMissing = "O.aff";
else
{ // All is ok, submit the data
console.println("All form data ok");
}
if(strMissing.length)
{// Got an error
app.alert("Missing Form data in field: " + strMissing);
}
