The dynamicoptions
tag automatically filters a question's set of options based on a respondent's answer to a previous question.
In the example above, Q1 presents three colors to choose from. Q2 uses dynamicoptions
to filter visible options based on the response to Q1. For example, if the respondent chooses '202 - Green' at Q1, then Q2 only shows options 4, 5, 6, and 97.
Details
- The
dynamicoptions
tag can be used with closed-end question types. - To define dynamic options:
- Input the question ID that will serve as the "trigger" (reference point). Use the "leading Q."
- Insert a comma, a space, and a left brace/curly bracket.
- Insert the first "trigger option" from the referenced question. In other words, what option from the reference question would need to be selected in order for the following options to be available? That's the trigger option.
- Insert an arrow function (
=>
). - Insert all valid answer options from the follow-up question in a comma-separated list within square brackets. Series syntax (two dots) is also allowed for continuous IDs.
- Repeat this until all trigger options have been listed, separating each set with a comma. Then, close with the right brace/curly bracket.
- The order of dynamic options follows the order defined in the original list, not the order specified by the
dynamicoptions
tag.
Additional examples
Hiding options for radio and checkbox questions
If your survey theme is not Flex, some questions may display irrelevant options as grayed out/disabled instead of hidden. To hide the options, add CSS to your page or your stylesheet. The example below uses the pagecss
tag to add CSS.
Comments
0 comments
Please sign in to leave a comment.