The maxchecked
and minchecked
tags are used with multiselect questions and tables to enforce a maximum or minimum number of selections, respectively. Validations are built in to ensure respondents cannot select more than the maximum or less than the minimum.
setlist: GENRES
randomize: y
1. Rap / hip-hop
2. Rock
3. Classical / Jazz
4. Pop
5. Funk / R&B / Soul
6. Bluegrass
7. Country
8. Blues
1. Which music genres do you enjoy listening to the most?
instruct: Select <b>up to 3</b>.
type: checkbox
maxchecked: 3
randomize: y
optsfrom: GENRES
2. Which genres would you enjoy seeing live?
instruct: Select <b>at least 2</b>.
minchecked: 2
type: checkbox
optsfrom: GENRES
Details
- The
maxchecked
andminchecked
tags can be applied to checkbox and listbox questions and tables. - The
maxchecked
andminchecked
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
). - Ranges can be specified by including both
maxchecked
andminchecked
on the same widget, though it is more efficient to use thenumchecked
tag to specify a range. - If a respondent selects the required number of responses specified with a
maxchecked
tag, all other responses will be disabled. Respondents can always deselect responses to choose new ones. - Including the
instructions
tag is recommended to clearly communicate how respondents should answer questions with themaxchecked
andminchecked
tags.
Additional examples
Restricting the number of responses in tables
When maxchecked
and minchecked
are applied to tables, the tag will apply to all rows (or columns in a vscale table). In T3, respondents can select up to three options per row. Unselected options will be disabled once the max is reached.
3. Which types of activities would you be interested in trying in these locations?
type: checkbox table
instruct: Select up to 3 per row.
maxchecked: 3
randomize: y
1. Visiting a museum
2. Touring a historic location
3. Attending a local sporting event
4. Attending a concert / play
5. Visiting a winery / brewery / distillery
rows:
1. New York
2. Boston
3. Los Angeles
4. Chicago
Varying the number of responses per row
It is possible to require a different maximum or minimum number of responses per table row by defining the table with the start table
widget and including either maxchecked
or minchecked
tags on each row. To define each row independently, we include a full line space between them and the options.
start table: 4
intro: How do you like these fish prepared?
type: checkbox
1. Sushi
2. Grilled
3. Poached
4. Baked
5. Pan-seared
1. Salmon
minchecked: 3
instruct: Select at least 3.
2. Tuna
minchecked: 2
instruct: Select at least 2.
endtable
Referencing previous questions
Both maxchecked
and minchecked
can reference previous questions or variables, such as using a value inputted in a prior question to limit the number of responses. Here in Q6, the max number of selections a respondent can make depends on their answer to Q5 ('$Q5').
5. How many vehicles does your household have for personal use?
type: integer
range: 1-10
6. Which vehicle model(s) does your household drive?
instruct: Select up to $Q5.
type: checkbox
maxchecked: $Q5
1. Ford
2. Chevrolet
3. Toyota
4. Honda
5. Nissan
6. Jeep
7. Hyundai
8. Kia
9. Mazda
10. Volkswagen
91. Other {autoother: y; placeholder: Specify}
Comments
0 comments
Please sign in to leave a comment.