Adding validation to your form's fields can greatly improve the accuracy of the data being collected. It helps to prevent data capture errors by checking the captured response against rules that you have specified. When a response is entered that does not meet the validation constraints of the field, a warning will show on the handset screen and the fieldworker will be prevented from continuing with the form.
Depending on the field type, you can add one or more of the following validation constraints:
|Constraint||Field type applicable to|
|equal to, not equal to||Text, Number, Date|
|greater than, less than, greater than or equal to, less than or equal to||Number, Date|
You can add, remove or edit validation rules at any time.
An icon on the right of the field name indicates whether validation has been added to this field (green) or not (grey). Clicking on this icon takes you to the relevant tab so that you can add, view or edit your validation rules.
Adding validation to a field
Click on the field you want to add validation to. In the 'Validation' tab, click on 'Configure validation rules' (only if you haven't specified any validation rules yet).
Choose whether responses will be valid if any one of the conditions is met, or only if all the conditions are met (1). Choose from certain comparison operators (2) (based on the field type). Finally, enter a value (3) for the condition. This can be a static value or a field reference or a function.
In the example above, a response to the field 'age' will only be accepted if it is greater than '0' and less than or equal to '100'.
You can add as many validation rules to a field as required. You can also easily remove a validation rule by selecting the bin icon to the right of the rule, or remove all validation rules by selecting 'Remove all' below them.
Hint: Test your validation rules by using the 'Preview' button on the far right in your top toolbar.
For more advanced validation, read here.
Using the legacy form designer? Have a look at our article on using Validation and Constraints in the legacy form designer.