Tip: You can do this in modern surveys and the script is now available! For more information, see How do I add an exclusive check box on a page with an Open End question? (Modern Surveys).
This script provides participants the option to opt-out of answering a Numeric question. Rather than allowing participants to skip the Numeric question, the checkbox allows participants to indicate why they do not want to provide an answer. You can provide multiple reasons such as "Don't Know" or "Refuse to Answer."
This procedure can be applied to any question type with appropriate modifications. Follow the steps below to add a checkbox to a Numeric question.
Detailed Steps
- Click the Questionnaire tab of your survey.
- Create a Page.
- Create a Numeric question within the Page.
- Deselect Question completion required in the properties of the Numeric question.
- Create a Multi Choice question within the page.
- Add the opt-out text as an answer option, such as "Don't Know" or "Refuse to Answer" and click OK.
- Deselect Question completion required in the properties of the multi choice question and delete the default instruction text from the question.
- Copy the script below into Notepad or any other text editor (e.g. Notepad++, Textpad).
- Replace VQ_Name with the question name of the Numeric Question.
- Replace DK_Name with the question name of the Multichoice Question.
- Insert the completed script into the Script section of the page by doing the following:
- Select the page in the Questionnaire Tree.
- In the Scripting section of the page, click Edit Scripts.
- Paste the script into the On Validate tab.
- Click Save.
- Validate and test your survey.
Script
This script forces participants to either select the checkbox or enter an answer for the Numeric Question.
/* Script Name: How do I add an exclusive check box on a page with a numeric question? To ensure your script works as expected, always copy the original script from the script library found in the support portal. Failure to use the most up to date script from the script library may cause unexpected results. */ //Force respondents to either select the checkbox OR answer the Numeric Question. VerbatimQuestion vq = VQ_NAME; ChoiceQuestion cq = DK_NAME; if ((vq.Value == null) && (cq.SelectedAnswer == null)) { if (this.Culture == "en-CA"){NewError("Please enter in a response.");} else if (this.Culture == "fr-CA") {NewError("Veuillez répondre à cette question.");} return; } else if ((vq.Value != null) && (cq.SelectedAnswer != null)) { if (this.Culture == "en-CA") {NewError("Please enter one response only.");} else if (this.Culture == "fr-CA") {NewError("Veuillez n'entrer qu'une seule réponse.");} return; }
Notes:
- The question names used in scripts are case-sensitive. Ensure that you use the exact question names as they appear in the Questionnaire tree of the survey.
- If respondents try to skip the questions or if they try to answer both questions, the Completed script will generate error messages in English or French (depending on the Panelist's culture property) to prompt respondents to answer one of the two questions.
Comments
0 comments
Article is closed for comments.