Boolean - Yes/No

Hello everyone,

I’m working on adding a feature to my app that allows users to choose between “Yes” or “No” using a pair of boolean checkboxes. I’d like to set up triggers so that:

  1. When the user clicks “Yes,” it remains selected.
  2. If they uncheck “Yes,” it should automatically switch to “No.”
  3. At least one of the checkboxes must be selected (users cannot proceed to the next step if both are left blank).
  4. Only one checkbox can be selected at any time (i.e., selecting “Yes” should automatically deselect “No” and vice versa).

Can someone assist me in setting up these triggers?

Hey Rramon,

This is a good puzzle. But through Tulip, all things are possible!

First, remember that Tulip boolean values have three possible states, Null, False, and True.

  1. Create two checkboxes, Yes and No. By default they will start with Null.
  2. Add a trigger on the Yes checkbox so that when it is clicked, IF YES == FALSE, SET NO = TRUE, ELSE SET NO = FALSE
  3. Add a similar trigger on the No checkbox.
  4. On your button to complete the step, add an error check using a conditional statement like so: IF YES IS TRUE OR NO IS TRUE.

Hopefully that helps you, but does not give you the answer entirely. This way you can practice to make sure you understand.

Happy Tulip-ing

1 Like

Hey @Rramon! Have you considered using a Single Select widget with the Radio button styling? Radio buttons are typically considered better user experience for either/or selection where only one can be selected at a time, and it may be simpler triggers to build it this way.

3 Likes

I like using this pass/fail custom widget in exactly this situation Pass - Fail Custom Widget

2 Likes