Limiting the number of checkboxes users can select (SL360)

Oct 28, 2021

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
Maria Costa-Stienstra

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!

Christopher Dawes

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.