The Survey Editor allows you to specify an exact number of values (i.e., answer options) that must be selected for a valid response to a question. If your question will not contain an exclusive answer option, see the instructions in: Setting an Exact Number of Values for a Valid Response.
1: Preparing the Question
To set up a question that contains an exclusive answer option and also requires an exact number of values that must be select for a valid response, first add the question and all the answer options. Next, click on the answer option you want to make exclusive so the options appear in the right panel. Check the box for "Exclusive" to enable it. If the QA codes are being shown (via the "View Options" menu), an "EXC" code will appear for the answer option.
2: Adding the XML
The next step requires use of the XML editor. To open it, click on the actions menu and choose "open xml editor."
Locate the question in the survey XML. After the comment tag (or the title, if there's no comment), enter the following code, updating the highlighted portions for your question, on a new line:
<validate> if not (this.count == 3 or this.r9): error("Please select exactly 3 features") </validate>
- "3" is replaced with the number of responses your question will require as a valid response
- "r9" is replaced with the row, column or choice label of the exclusive answer option
- "Please select exactly 3 features" is replaced with the error message that will be displayed if a respondent tries to enter a number of responses that does not match the required number
Once the code has been entered, save the changes and click "done" to return to the Survey Editor.
3: Testing the Setup
To test, choose "Test Survey" in the actions menu. Locate the question and attempt to select a different number of values than is required and continue. The question will display the error message you specified in the survey XML. When the correct number of answer options is selected you will be able to continue to the next question.