Forum Discussion

ChristopherD273's avatar
ChristopherD273
Community Member
5 years ago

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

  • 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:

    Windows 10 (1) 2021-10-28 at 1.25.04 PM

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

    Windows 10 (1) 2021-10-28 at 1.25.12 PM

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

    Windows 10 (1) 2021-10-28 at 1.30.31 PM

    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. 

  • 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.