Forum Discussion
Limiting the number of checkboxes users can select (SL360)
I'm trying to figure out how I can limit the number of checkboxes that a user can have selected at any given time. What I would like to do is display a message if the users has 5 boxes selected and then tries to select a sixth.
I thought that I could add and subtract from a number variable, but I've tried numerous combinations of triggers and can't get the variable to add and subtract correctly.
Any suggestions would be greatly appreciated.
Thanks!
7 Replies
- MariaCSStaff
Hi, Christopher.
Thank you for sharing your .story file!
While I'm a little confused about your use of the radio buttons in FormView, here's a suggestion to accomplish what you asked:
- Connect the triggers to the submit button. That way, you won't have to subtract a value of one when the user cancels the selection:

- Submit the interaction only if the variable Top5DD is equal to or less than five.

- If it's more than five, then set the variable to zero so the count can restart:

Let me know if that works!
- ChristopherD273Community Member
Thanks for the suggestion Maria!
The radio buttons will be so that I can grade the checkboxes individually since partial grading doesn't exist for pick many questions.
- WaltHamiltonSuper Hero
Here's a sample of what that might look like. You were writing the right triggers, you just quit too soon.
- ChristopherD273Community Member
Awesome, thanks Walt! That's what I was trying to do!
- WaltHamiltonSuper Hero
You're welcome. PIAWYC (Pass it along when you can).
- ChristopherD273Community Member
Just out of curiosity, is there a way to accomplish this functionality by adding and subtracting from the number variable before the user even clicks the submit button? I was originally thinking that it would work by doing the math based on the current states of the checkboxes, but that wasn't working correctly.
- WaltHamiltonSuper Hero
Sure. The secret is not to think in terms of adding and subtracting, but start each time from zero and count. It uses a lot fewer triggers, especially if you put all the counting in one place.
Related Content
- 2 years ago
- 3 months ago
- 10 years ago
- 3 months ago
- 7 months ago