Limiting Responses with Validation Criteria

Last Updated: Oct 09, 2014 08:06PM EDT

Validation criteria are one of the best features in in electronic forms. This feature allows you to avoid accidental or invalid answers, especially to numeric questions (Integer or Decimal response types). However, validation can be used on any question. Validation criteria are also sometimes referred to as constraints.

For example, you want to restrict a question about age to numbers between 0 and 130.

How to add validation criteria

To add validation criteria for a specific question, go to Settings, then Validation Criteria.

Criteria: Write your validation criteria in XLSForm syntax (see examples below) Error Message (optional): This is the message your interviewer sees when they enter an invalid response.

Example Validation Criteria

Criteria Explanation
. > 17 Response must be greater than 17
. >= 18 Response must be greater than or equal to 18
. > 17 and . < 130 Response must be between 17 and 130

Note that in the validation criteria syntax, . refers to the current question. ${some_question} refers to the fixed Name of a question, which needs to be set in the Question Options and then surrounded by ${}.

Examples of More Advanced Validation Criteria

Criteria Explanation
(. >= 18 and . < 130) or (. = 999) Response must be between 17 and 130 or be 999. (The code 999 is often used for non-responses.)
not(${in_university} = 'yes' and . < 16) When answering yes to question in_university, response must be greater than 16.
not(selected(., 'none') and (selected(., 'chair') or selected(., 'table'))) Response 'none' can't be combined with the two other options of this (Select Multiple) question

There are many other combinations possible, including advanced mathematical calculations. See here for more details.



Questions about certain features, general issues, or stuck somewhere?
Post your questions here and help other users.

Please only post your question in one of the three channels to avoid duplication.
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found