...
Basic validations regarding data types will be specified by the underlying Form Schema of the form like the data type of a form or number ranges for example.
In order to create more specific custom validation rules for form fields, you can add the validation
attribute to each field in the Form Config. For example:
Code Block | ||
---|---|---|
| ||
{ "title": "Person", "description": "A person form", ... "layout": { "items": [ { "field": "firstName", "validation":[ { "type":"js", "rule":"!!val", "message": "Field is required!" }, { "type":"js", "rule":"val.length > 2", "message": "Must be longer than 2 chars!" } ] }, ... ] } } |
...
This will produce the Field is required!
message if the respective field is not given, as seen below:.
Info |
---|
The expression |
Example: Number ranges (min / max)
...