Validation rules help ensure that submitted form data meets specific conditions. This article explains how to set up pass/fail validation rules that can mark your form as valid, invalid, or show error messages based on field values.
Creating Pass/Fail Validation Rules
- Select the "Form" tab at the top of the alert
- Click on the field you want to add validation to (in this example, a "Selection Box")
- Open the "Field Validation Rules" panel on the right side
Setting Primary Validation Condition
To set up your first validation rule:
- In the validation panel, drag the field from the form layout
- Select the comparison operator (equals "=" in this example)
- Enter the value from the 'Field Properties' tab that will make the form pass (in this example, "Pass")
This configuration means that when the field equals "Pass", the form will be marked as valid.
Adding Alternative Valid Conditions
You can add alternative conditions where the form is still valid:
- Under the "Otherwise, mark form as [Valid] without message, when" section
- Set up another condition (in the example, when the field equals "N/A")
data["field"]=="N/A:
Setting Error Conditions
For cases where the form should show an error:
- Find the last section: "Otherwise, mark form as [Invalid] with message"
- Enter your error message (in this example, "please notify QA")
- Set the condition that triggers this error (when value "1" equals "1", which acts as a catch-all for any other values)
1==1
Understanding the Logic Flow
The validation rules are processed in order:
- If the field equals "Pass", the form is valid
- Otherwise, if the field equals "N/A", the form is still valid
- Otherwise, mark as invalid and display the specified message
Testing Your Validation Rules
Before finalising your form:
- Preview your form with the play button
- Test different input values
- Verify that the form behaves as expected with each value