Answered
syntaxError: function statement requires a name error.
I have this document JavaScript that is suppose to work in conjunction with a fields custom validation script, which is to prevent a user from leaving a field blank. It does not seem to work. In the Console I get:
SyntaxError: function statement requires a name
1:Doc:Exec
Any ideas would be much appriciated.
Document JavaScript
function isFieldBlank(fieldName) {
console.println("Running isFieldBlank on: " + fieldName);
var field = this.getField(fieldName);
if (!field) {
console.println("Field not found: " + fieldName);
return true;
}
var val = field.value;
if (typeof val === "string" && val.trim() === "") {
console.println(fieldName + " is blank.");
app.alert("This field cannot be left blank.");
field.setFocus();
return true;
}
console.println(fieldName + " has value: " + val);
return false;
}
Custom Validation Script
event.rc = !isFieldBlank(event.target.name);
