To enforce business rules that have to be met before users can submit a form, you assign Validation Rules for each component whose input field value has to be validated.
To assign Validation Rule to an Input Field component:
- Open your form in the Visual Designer, Find the page on which the Input Field component you want to assign Validation Rule to is located.
- On the page find the Input Field component you want to assign Validation Rule to and click on it. The component is now highlighted and its settings are displayed in the Properties panel.
- In the Properties panel click on "More Settings..." link and then select "Validation Rules".
If you already have at least one Validation Rule assigned, use "Modify" button in the section that states "Field has XX validation rule(s)".
- In the Editor window that will open, select the rules you want to apply from the list on the left and drag it into the rules area on the right and set the rules properties and save.
- In the Properties panel there is now a section with "Field has 1 validation rule(s)" label and two buttons: "Modify" button which will open the Editor again and "Delete" button that allows you to remove Validation Rule(s) assignment.
- Commit your changes by clicking on "Commit" button in Controls panel and then click "Preview Form" button to test the rule. Enter 5 characters into the field you defined the above rules for and then click "Next" button. The error message/s you set for the rule/s will be displayed at the top of the field (if you are on the last Submission page, click on "Submit" button).
Please be aware of how a component's state affects validation process:
- if component is in Required state - no matter what Validation Rules are set, if input field value is empty an error will be generated;
- if component is in Hidden state - rules are ignored, no validation occurs;
- if component is in Optional or Read Only state - validation will be executed if the field is not empty.
See Validation Rules for more details.