Form validation
Forms automatically validate their fields if a form schema has been assigned, showing validation error messages underneath any violating fields.
The validation rules are defined by the Constraints of the linked table.
Validate form action
Forms created within Autogenerated screens will automatically provide a 'Save' button with a Validate Form action.
If you want to add the Action manually, simply select Validate Form from the action list.
Next choose the form you want to validate from the dropdown. In order for the form to appear within the options list, the button must be nested within the form in the component tree.
This action will trigger the form validation, show any errors, and stop executing any further actions if the form is invalid.
The standard way to use this is for your first action to be validating the form, and the second action to be performing your task - for example saving a row. This ensures only valid forms will be submitted.
Name | Phone Number |
---|---|
Form steps
Validation is only triggered for the fields within the currently displayed form step
Custom validation rules
There are a number of scenarios in which you would want to use custom validation rules:
- You are using a custom Form Schema
- You want access to regex pattern matching
- You want to use a Binding in your validation conditions
- You want to display a custom violation message
To add a custom rule, click on your form field. Then within the settings panel click Configure validation.
A panel will appear, from which you can add rules, enter constraint bindings, and enter custom validation messages.
Regex
One of many use cases for using regex would be to check for alphabetical characters only.
To do this, select Must not match regex with the value: [^a-zA-Z\s]
Conditional validation rules
It is also possible to dynamically change validation rules through Conditional UI.
Add a condition to a field, then select Update setting and Validation from the dropdowns.
You will then be able to click configure to add custom rules as shown above.
Finally, set a condition for applying that validation. When the condition is no longer met, then that validation rule will be removed from the field.
Updated 10 months ago