Validation Example: None of the Above
When you add a Select Many Question question with a "None of the Above" option you will want to ensure that a user that selects "None of the Above" does not also select another option.
The following example describes how to create a Validation Message to validate that a user that chooses "None of the Above" does not also submit another option. Here are steps to add this validation:
- In the Edit tab, insert a Select Many question.
- In the Edit tab, right-click the Select Many question that you added, and click Insert After.
- In the Question Gallery, click the Validation Message question type.
- In the Validation Message question editor, enter your validation text, for example:
"If you choose None of the Above you cannot choose any other answers. Please click Back to correct your answer."
- Click the Ask if button to add an Ask if condition.
- For the Question, choose Other (at the end of the list) and click OK. This will bring you to the Ask if Conditional page where you can enter a conditional statement.
- Enter the condition for the Validation Message question, and click OK. For example, here is a conditional statement that displays the Validation Message when a user submits None of the Above and another option. This example assumes that your question is Q4.
find([Q4],"None of the above")!=-1&&[Q4]!="None of the above"
For more information on formulas in Vista, see Formula Commands.
- Click OK again to return to the Edit tab. You will notice that there is an error on the Edit tab because the Validation Message question is not separated from the "None of the above" Select Many question by a page break. These question must be separated by a page break in order for the condition placed on the Validation Message question to be evaluated.
- In the error message, click Fix it for me. You can also fix this error by right-clicking the Validation Message and then clicking Break Before.
- Click Save.
Here is how your final questionnaire will look:
NOTE: If you use the option "Other" in a question with possible answers (for example, Multiple Choice, Select Many), it is always placed last in an option list. If you want an option to be listed last in a list of options place a ~ (tilda character) before the option value. For example, if you wanted the option "None of the above" listed last, you would enter the option as "~None of the above".