The documentation for this is woefully inadequate:
I’m trying to combine regular validation with some custom validation on one field. When the onFieldValidation hook runs, it clears all of the rest of the validation messages on the form. If I disable the custom onFieldValidation scripting in FM, the other validation messages persist.
This is where the documentation is confusing:
### onFieldValidationHook
This hook is called when a field has been assigned an `fmsHook` validator.
The `.validation` object is broken out for you in the var `$validation` You can make business logic decisions based on the data here. The rest of the other objects are also available including `$actions` so you can inject workflow changes too.
To pass back validation error messages set the `validation.error` element to your error message.
There is no $validation variable in the script when it runs.
Setting anything to do with $validation also does nothing to pass data back to BF
This comment in the script is also confusing:
To return validation.error : "Your Error message or empty"
Can someone please update this documentation with a better example?