Set up a validation rule for a question

Create a validation rule for any type of question in a form when you want to verify that entered answers to a specific question meet the study requirements.

Validation rules are useful when you want to block site users from entering unaccepted values for answers to given questions. Depending on the type of question you are working with, different validation rules options are availabe to define.

Question type Validation rules
Text question
  • Doesn't contain
Date/Time and Date of birth questions
  • After
  • On or After
  • Before
  • On or Before
  • On
  • Not On
  • Not Between
  • Range
Number and Age questions
  • Greater Than
  • Greater Than or Equal To
  • Less Than
  • Less Than or Equal To
  • Is
  • Not Equal To
  • Not Between
  • Range
Drop-down and checkboxes questions
  • Select at Least
  • Select at Most
  • Select Exactly
  • Answer Must Be
Radio Buttons questions
  • Answer Must Be
You can define more than one validation rule for a question, if applicable, and only for question types that have more than one validation rule options: Date/Time, Date of birth, number, age, drop-down and checkboxes. To do this you must select a logical operator:
  • If you select AND, the value must be valid for every validation rule.
  • If you select OR, the value must be valid for exactly one validation rule.
However, these operators can not be combined if more than two rules are added. For example, if you have three validation rules on a question, you can select AND for every rule instance or OR for every rule instance, but you cannot select AND followed by OR.

For further details about how to set validation rules for a specific question type, browse the sections below:

Define a validation rule for text questions

For text questions only one validation rule is available to limit the field to alphabetic characters only.

Validation rules for text questions

For text questions, one validation rule is available. The rule limits the field to only alphabetic characters.

  1. Select Doesn't Contain.
  2. Enter an Error Message. The error message appears for site users when the answer is missing or invalid.

  1. Navigate to Rules as described in Access the rules section.
  2. Click Add Validation Rule and select Doesn't Contain
    A Validation Rule box with editable settings appears below the Rules section on the right side pane.
    Validation rules are a set of settings that you configure.
  3. In the Error Message field, type an error message that should appear for site users when the answer is invalid.

Define a validation rule for Date/Time and Date of birth questions

Date/Time questions have multiple validation rules available to allow site users to enter only certain dates in time.

When setting validation rules, age questions have the particullarity that they can be treated as numbers, referring to the age value, or as dates by using the Date of Birth. To set a validation rule related to the age value, see Define a validation rule for number and age questions.

  1. Navigate to Rules as described in Access the rules section.
  2. Click Add Validation Rule and select one of the validation rules available:
    A Validation Rule box appears below the Add Validation Rule button with editable settings.
    Validation rules are a set of settings that you configure.

    Note:

    For age questions, these options will be available to select once you select Date of Birth from the Add Validation Rule drop-down. In these cases, the box is titled Date Rule.
  3. Enter values according to the type of validation rule:
  4. In the Error Message field, type an error message that should appear for site users when the answer is invalid.

You can define more than one validation rule for a number or age question, if applicable. For age questions you can combine Age validation rules with Date validation rules.

Repeat the steps to add new rules as required and, once you have added the new rules, select a logical operator from the drop-down between rules:
  • If you select AND, the value must be valid for every validation rule.
  • If you select OR, the value must be valid for exactly one validation rule.

Define a validation rule for number and age questions

Number questions have multiple validation rules available.

When setting validation rules, age questions have the particullarity that they can be treated as numbers, referring to the age value, or as dates by using the Date of Birth. To set a validation rule related to the Date of Birth, see Define a validation rule for Date/Time and Date of birth questions.

  1. Navigate to Rules as described in Access the rules section.
  2. Click Add Validation Rule and select one of the validation rules available:
    A Validation Rule box appears below the Add Validation Rule button with editable settings.
    Validation rules are a set of settings that you configure.

    Note:

    For age questions, these options will be available to select once you select Age from the Add Validation Rule drop-down. In these cases, the box is titled Age Rule.
  3. Enter values according to the type of validation rule:
  4. In the Error Message field, type an error message that should appear for site users when the answer is invalid.

You can define more than one validation rule for a number or age question, if applicable. For age questions you can combine Age validation rules with Date of Birth validation rules.

Repeat the steps to add new rules as required and, once you have added the new rules, select a logical operator from the drop-down between rules:
  • If you select AND, the value must be valid for every validation rule.
  • If you select OR, the value must be valid for exactly one validation rule.

Define a validation rule for drop-down and checkboxes question

For drop-down questions or questions with checkboxes, you can specify the number of options that users must select, or require users to choose a given option. For example, the Select Exactly validation rule is configured for questions that must be used in defining a minimization design or enrollment limit.

  1. Navigate to Rules as described in Access the rules section.
  2. Click Add Rule and select one of the validation rules available:
    A Validation Rule box appears below the Add Rule button with editable settings.
    Validation rules are a set of settings that you configure.
  3. From the dropdown below rule type, select the answer options that a user must select:
  4. In the Error Message field, type an error message that should appear for site users when the answer is invalid.
You can define more than one validation rule for a drop-down or checkboxes question, if applicable. Repeat the steps to add new rules as required and, once you have added the new rules, select a logical operator from the drop-down between rules:
  • If you select AND, the value must be valid for every validation rule.
  • If you select OR, the value must be valid for exactly one validation rule.

Define a validation rule for radio buttons questions

A question with radio buttons requires only one option as an answer. By adding a validation rule, you can require site users to choose a specific option. This is particullarly useful to define screening requirements.
  1. Navigate to Rules as described in Access the rules section.
  2. Click Add Rule and select Answer Must Be
    A Validation Rule box appears below the Add Rule button with editable settings.
    Validation rules are a set of settings that you configure.
  3. In the Required Answer field, select the exact answer that must be selected by the site user.
  4. In the Error Message field, type an error message that should appear for site users when the answer is invalid.