For multi-select questions such as checkbox or listbox question types, a common request is to specify the quantity of responses a single respondent can select to an arbitrary number or range. Programming instructions might specify, "Allow respondents to select up to three responses," "Select exactly 2 responses," or similar. To facilitate this sort of request, choose from among the maxchecked
, minchecked
, or numchecked
tags. These tags allow Survey Programmers (SPs) to impose a maximum, minimum, or range to the number of responses a survey taker can select on multi-select questions. If the respondent supplies too few responses, an error message is displayed, and once a limit has been reached, all other options are disabled. These tags work with checkbox
and listbox
types, and also work in all different table configurations utilizing those types.
Caution! Usage of these tags on an invisible question (invisible
, selectby
, or otherwise) will prevent the respondent from being able to advance past the page!
Note: Minimums and the lower bound of ranges specified via these tags are enforced if the question has a response. Minimums are not enforced if the question has no answers. To require a question response, the required tag should be present on the question widget or in effect via setdefaults
, new page
, or start group
widgets.
Syntax
Maximum
When the maxchecked
tag is applied to a question, once the maximum number of responses is met, all non-selected options are disabled. To alter the selection, deselect one or more of the responses to re-enable the other options.
maxchecked: Maximum number of answers
Minimum
When the minchecked
tag is applied to a question, if the respondent attempts to submit their responses without meeting the minimum, a validation error will occur and the respondent will be prompted to "Please select at least X items."
minchecked: Minimum number of answers
Specific
The numchecked
tag will accept various operators or a range of options. If a maximum is set, like maxchecked
, the other unselected options will be disabled. If a minimum is set, but not met, then like minchecked
, a validation error will occur and the respondent will be prompted to "Please select at least X items."
numchecked: Number of answers
Examples
maxchecked and minchecked
The maxchecked
and minchecked
tags accept a single input that may be numeric, a variable reference which contains a numeric value, or methods which evaluate to the desired input (e.g. countChecked
). These inputs define the number of options that must be selected in order to disable all remaining unselected options, or the minimum number of options that must be selected for the question to validate successfully.
In Q1, the maxchecked
tag is used to limit the number of responses to 3. In Q2, if the respondent selects less than 2 options, they will be prompted to select at least one more option.
When 3 responses are selected, the remaining unchecked responses are disabled, so the respondent cannot select any more answers. If the respondent was to uncheck one of the selected answers, all options would become enabled again.
Tip! In many situations, it is highly recommended to include the instructions tag on a question with maxchecked or minchecked, so that the question's requirements are communicated clearly to the respondent.
Tip! Although it is more compact to use numchecked for specifying a range of accepted answers – e.g., numchecked: 1 to 3
– SPs can also use minchecked
with maxchecked
to specify a range.
In tables
All three tags also work in tables, where all question cells need to have the same maximum number.
Tables with differences per-row
It is possible to define different maximums or minimums per row or column question cell.
Question reference
References to prior questions are also accepted, such as using the value inputted in a previous question as the value for the minchecked
(or maxchecked
) input.
numchecked
The numchecked
tag allows SPs to use logic operators to specify a lower or upper bound to the number of selections, an exact number, or a range of values.
At present, numchecked
does not support < (less than) or > (greater than) operators.
Comments
0 comments
Please sign in to leave a comment.