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:


Field typeValidation rules supported
Text Field

Response:

  • Is equal to
  • Is not equal to
  • Matches regex
Number Field

Response:

  • Is equal to
  • Is not equal to
  • Is greater than
  • Is less than
  • Is greater than or equal to
  • Is less than or equal to
Date/Time Field

Response:

  • Is exactly
  • Is not
  • Is after
  • Is before
  • Is exactly or after
  • Is exactly or before
Select Many Choice Field

Number of options:

  • Is equal to
  • Is not equal to
  • Is greater than
  • Is less than
  • Is greater than or equal to
  • Is less than or equal to



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 rules to a field


Click on the field you want to enforce validation for. In the 'Validation' tab, click on 'Configure validation rules'. 




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, a field reference or a function




In the example above, a response to the field 'agewill only be accepted if it is greater than or equal to 18.


By default, the error message displayed if an invalid response is entered is "Value not allowed" but if you prefer, an optional custom validation message (4) can be set. This is useful for giving fieldworkers/respondents feedback on why the response is invalid.


Hint: Test your validation rules by using the 'Previewbutton on the far right in your top toolbar.  




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.

 



For more advanced validation, read here