Validation rules ensure validation of data inputs on several question types, such as dates.
The full list of the question type that supports the validation rules can be seen in the table below.
Question type | Validated against |
Number |
Static number |
Date |
Fill out date Date of birth (if subject attribute available) Enrollment date Other date questions in the same form (+/- offset) |
Date/Time |
Fillout date Date of birth (if subject attribute available) Enrollment date (+/- offset) |
Specific time |
Static time |
Duration |
Static number |
Multiple Choice | Selected possibilities |
Multiple Response | Selected possibilities |
Yes/No | Selected possibilities |
Smiley | Selected possibilities |
Table questions |
Each column can have validation if it has one of the above question types |
Fill out: Until a user SAVES a form, fill out date will be "today's" date. Once the form has been saved, fill out date will be the date of the first save.
Enrollment: The date the specific subject enrollment was created.
Actions:
Applying validation rules can have one of three consequences when broken:
- Block Answer: Will block the form from being saved, so long as the answer breaks the rule.
- Show Warning: Will allow the answer to be saved but will display a warning text in orange color. The warning text can be specified by the user, if nothing is specified it will use a default text.
- Generate Query: Will automatically create a query on the answer, and notify anyone with the “Query Permission”. The creator of the query will be denoted as “System-generated query”
How to add Validation Rules:
Validation rules are added during form creation, the Validation Rules tab will appear underneath the question for supported question types.
To add a new rule click “Add Validation Rule”
The validation rules should ideally be filled in from left to right. The comment text is optional, if no text is entered the system will use a default text (which can be seen in the Comment text field, once the rule has been created).
Validation rules can not be added or amended for questions, which already have been filled out during data collection.
Examples:
Number question
Adding a validation rule to a number question requires a few settings to be selected. Select the appropriate operator e.g. < (Less than), that will break the validation rule. Then specify the value that the operator applies to, the action type, and comment text.
¨
To add min/max values to a number question, it requires two validation rules with the block consequence.
Multiple Response question
You can define the minimum and a maximum number of answers.
Free text question
Allows the user to limit the number of characters that can be entered.
Date + Date/time questions
These question types require similar validation rules settings as number questions, but Date + Date/time questions also introduce "offset", which allows one to "change" the date validated against. E.g.: Enrollment + 7 days, would have the input date be validated against the subject's enrollment date + 7 days. If the subject was enrolled on the 1st of April in the example the validated date would be the 8th of April.
Whereas if you use -7 the date would move in the other direction
Possibility question operators:
The possibility-type questions have a set of operators that are explained in the following paragraph.
Multiple choice, Yes/No, and Smiley scale uses the operators "Any" and "Not any". If you use "Any" it means that should the user select any of the preselected possibilities the rule will trigger. Using "Not Any" means that if the user does NOT select any of the preselected possibilities then the rule will trigger.
E.g.: "If Answer is Any of Yes then show a warning", if the user then selects 'Yes' during fill out, the warning will show.
Multiple response is a special case, as here multiple possibilities can be selected when answering the question.
There are therefore four operators: Any, Not Any, All, Not All. Below are illustrations of when each of these four operators is triggered and e.g. a warning is shown.
The orange square denotes the subset selected during the setup of the validation rule.
The arrows denote the possibilities selected during data collection
In each of the examples, we have four possibilities in the multiple response question
Includes All
If the " Includes All" operator is used, the ENTIRE subset must be selected by the user during fill out, for the rule to trigger.
Not Include All
If the "Not include All" operator is used, the rule will trigger if the ENTIRE subset is NOT selected during fill out.
Includes Any
If the "Includes Any" operator is used, the rule will be triggered if at least ONE of the possibilities included in the subset is selected during fill out
Not Include Any
If the "Not Include Any" operator is used the rule will be triggered if NONE of the subset is selected during fill out