How to dynamically change a Checkbox value based on another element's value

I have a simple UI that has a radio button and a checkbox.

I want to set the check to Checked and disable the checkbox if the “Production” radio button is selected.

This is what it looks like

Using the Conditional tab on the properties, I can disable the Checkbox but I cannot find out how to set the Checkbox to “Checked”

Here “Production” is not selected and checkbox is enabled

and here “Production” is selected and the checkbox is disabled

I have tried using a workflow but that does not seem to allow me to set the Checked value either.

I think I am missing something fundamental as to how Bubble works and it can be frustrating to get the simplest things done!!

Hey mate,

Honestly, I find checkboxes really annoying to use because of this issue, so I completely understand your frustration. The property “This checkbox should be checked” doesn’t assign the value “yes” to the checkbox, instead, it means that any workflow that is reading the value of the checkbox will not run unless the checkbox is ticked. This is useful for situations where for example, a person needs to agree to the terms and conditions of a website - and you don’t want them to continue until they have clicked that checkbox.

In your situation, you will need to use the “preset status” and set this to dynamic. Preset status is the default value of the checkbox when the page loads. The moment the checkbox is clicked, preset status no longer applies, so you have to essentially “reset” the checkbox without refreshing the page.

The way I would do this is as follows:

  • Put the checkbox in a group. Make the group of type “yes/no”, and set the value of the group to the value you would initially want the checkbox to be (I assume “no”)
  • Change the checkbox preset status to Dynamic. Make the value of this “parent group’s yes/no”
  • Add a workflow for when the radio button’s value is changed (i.e. “an input’s value is changed” - select your radio button for licence type)
  • Within that workflow, add an action with a conditional for when the value is “Production”, display data in the Group that is holding the checkbox to “yes”. This will then flow on to the checkbox.
  • Within that workflow, add an action with a conditional for when the value is “Demo”, to reset the data for that group. This is the way you “reset” the preset status. (edit: in hindsight, I think if you just displayed the value “no” in the group, it would still work. But this approach should work too).

With the above configuration, when you select Production, the checkbox will always shift to ticked. When you select Demo, it will always go back to unticked (but the user can override this and tick it). Hopefully I haven’t missed a step, but let me know if that doesn’t work.

I know that’s a very tedious and long-winded solution! Hopefully someone else can provide a better solution, but that’s what has worked for me previously.

1 Like

Thank you sooooo much. This has solved my issue and wow, that is quite convoluted. I wish there was a way to preserve the checkbox value when going from Production to Demo


1 Like

No worries derick. It might be possible to do that if you play around with the conditions on that workflow.

Alternatively, it might be worth reconsidering the UI on the checkbox. If people are more often needing to require activation, and this isn’t a particularly critical decision (i.e. you don’t need them to be extra sure before ticking), it might be best to use a default of ticked on the box.

1 Like

Thank you, I will play around with that.