How to set a field value depending on a checkbox

I’ve been able to do some complex things with Bubble but I can’t do this!

I have a text field called (Driver) Status. When I create a new Driver, using a set of Input forms, I want to be able to set Status to “Standby” if a checkbox called Eligible is checked, otherwise Status will be set to “Off-call”.

My attempt uses a custom state called status_text which is sent to the Status field when a button called Iconic…checkmark is clicked. This is step 1 of the work flow when Eligible is checked:

When Eligible isn’t checked status_text is set to “Off-call”, in step 2 of the workflow.

This works fine for the Standby case but for the Off-call case the flow stops.

I can’t help feeling there must be a simpler way - some kind of “if this then that else the other”!

Try two separate events.

When checkbox eligible is checked > set state Standby
When checkbox eligible isn’t checked > set state Off-Call

That’s almost a good solution :slight_smile:
What happens though is that I have the checkbox preset to checked, and if I add a new driver and I don’t change the checkbox then Bubble doesn’t see that as an event.
So it doesn’t change the state (the state remains empty).
To use your method I really need a workflow that looks at the static state of the checkbox.

I thought I could fix it by using the logical AND of the Eligible checkbox and the check to complete the page but that didn’t work. The issue is with the checkbox input - it responds to changes only.
I’ll need a different input element I think…

Actually I could solve it with the AND:
When check-to-complete is clicked and checkbox eligible is checked > set state Standby, then create a new driver
When check-to-complete is clicked and checkbox eligible isn’t checked > set state Off-Call, then create a new driver

Thanks http://forum.bubble.io/u/romanmg

This topic was automatically closed after 70 days. New replies are no longer allowed.