Validation will allow you to define valid values for a field. If the user enters an incorrect value, then an error will be displayed to encourage the user to change it.
If the Validation script returns true, the attribute value is valid , if it returns false then the value is not valid and an error message is returned.
Adding a custom validation error message
<pre class="wp-block-syntaxhighlighter-code">// Validate that a Field attribute value is between 10 and 20.
// - If the value is not valid return a custom error message.
if( f < 10 || f > 20 ) {
// value is valid
return true
} else {
// value is not valid, so return a custom error message
return "Value " + f + " is not allowed"
}