Evolutility automatically generates Javascript for field validations on the client. This Javascript executes when the user clicks the "Save" button.
Validation is determined by the field properties (XML attributes):
If the form doesn't pass validation, a messages is generated in the locale of choice (without additional text to enter) and shown to the user in a lightbox.
In addition, after the user clicks OK and the lightbox disappears, fields not passing the validation are flagged in red on the form.
It is possible to add custom validation to Evolutility forms by using Javascript.
This is a 2 step process:
The Javascript function will be passed 2 arguments: the field ID and the field label. It needs to return a string with the error message if the validation is not correct, and return null otherwise.
For example to only allow company names starting with "E":
In the XML
In Javascript
Second example this time we want to force at least one of the 2 "Home phone" or "Mobile" to have a value.
In this second example, we used hard-coded field names and labels so we didn't give arguments to the custom function. Also, even though 2 fields are involved in the validation, we only needed to declare the rule once in the XML (on the field that will be flagged in red if the test fails).
See examples of custom validation.