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.
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.
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.
7 Replies
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:
Let me know if that works!
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.
Here's a sample of what that might look like. You were writing the right triggers, you just quit too soon.
Awesome, thanks Walt! That's what I was trying to do!
You're welcome. PIAWYC (Pass it along when you can).
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.
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.