This script will dynamically change the minimum value allowed at a Numeric question, depending on what was previously entered at another Numeric question.
Note: The script works on a standard Numeric question, but will not work for a Numeric Slider.
Example
You have a Numeric question called Q1 that asks a participant the least amount of dollars he/she would be willing to pay for a certain product and the participant types "25". You then have another Numeric question called Q2 that asks the participant the maximum amount of dollars he/she would be willing to pay for the product. The response at Q2 cannot be less than 25 and should only accept values 25 and above.
Detailed Steps
- Click on the Questionnaire tab of your survey.
- Create your first Numeric question as required.
- Create your second Numeric question as required.
- Copy the script below into Notepad or any other text editor (e.g. Notepad++, Textpad).
- Change NUMERIC_2 to the name of your second Numeric question.
- Change NUMERIC_1 to the name of your first Numeric question.
- Insert the completed script into the Script section of your second numeric question by doing the following:
- Select your second Numeric question in the Questionnaire Tree.
- In the Scripting section of the question, click Edit Scripts.
- Paste the script into the On Load tab.
- Click Save.
- Validate and test your survey.
/* Script Name: How do I ensure a Numeric question response is greater than or equal to a previous Numeric question response? 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. */ NUMERIC_2.MinimumValue = NUMERIC_1.IntValue;
More Information
For more information, please see our webhelp article Numeric question.
Comments
0 comments
Article is closed for comments.