The selectall
tag and script are used to automatically select all of the other checkbox response options in a question by checking the specified response option. This is useful for creating an "All of the above" type option in a checkbox question.
Try it!
Syntax
Check all options
selectall: Option ID
Check an option subset
selectall: Option ID, Option IDs to check
Note: Starting in r8.0, Survey Programmers (SPs) may specify a range of values with selectall
using a disjointed set, similar to a series
tag. For example, instead of listing out all the consecutive options as selectall: 99,1,2,3,4
, we could instead use selectall: 99,1..4
.
Examples
Check all options in a question
When a respondent checks the 'All of the above' option, all of the other check boxes are automatically checked. Clicking the 'All of the above' option a second time unchecks the other options.
Grouped options and conditioned lists
It's possible to include a certain option or group of options that should be checked while leaving others unchecked. To do this, use a comma-delimited list of options. The first number in the list is the trigger option that selects all of the specified options, and any numbers following the first number are the options that are to be checked if the trigger option is checked.
In the example below, the selectall
script is used more than once to create two separate options to select their own larger set of options. If option 98 is selected, then it will also automatically check options 1 - 4; if option 99 is selected, then it will also automatically select options 5 - 8. Both options 98 and 99 can be selected to select all flavor options.
In the follow up question Q3, a condition is placed on the FLAVORS list to only display the list options that were selected in Q2. Although potentially all options from FLAVORS could be selected here and it would seem that one should be able to use a range, e.g., selectall: 100,1..8
, due to the conditional statement on the listcall for FLAVORS, all options must be listed out in a comma-delimited list.
Note: When applying conditional statements to options used in a question, attempting to list the options using a range with the selectall
tag will lead to a parse error. Instead list all options in a comma-delimited list with the selectall option first.
Using exclusive with selectall
The selectall
and exclusive
tags work as opposing functions. When combined, clicking the selectall option will select all options (or all specified options) except for the exclusive option. Clicking the exclusive option will then deselect any previously selected options, the equivalent of negating the selectall selection. SPs may either just list the option ID for the selectall option in the tag, or list the "selectall option" first, followed by the options to check with it in a list after. Usually the latter is used when a subset of options should be selected with the selectall option.
Note: selectall
is currently not able to be used as a decorator, the way exclusive
is employed in the above example.
Comments
0 comments
Please sign in to leave a comment.