Trouble with an input dropdown

I am trying to make a simple input dropdown with “yes/no” as the options. My goal is that when you click a button, the input value is saved under the database with the appropriate response.

The input field is named Dropdown Yes/No and I have entered the static values as Yes and No. When clicking the button, it only gives me “Yes” and does not read the “No” option when selected. Here is my logic for the workflow, although I have tried many alterations of this: Attendance = Dropdown Yes/No’s value is Dropdown Yes/No’s value

Does anyone know how to approach this so that I can get the workflow from the button to save the correct answer in the database?

If you’re using static values in your dropdown, they will evaluate to texts.

I’m guessing that the value you’re trying to save is an actual ‘yes/no’ type… therefore you can’t set it with a text when it’s expecting a yes/no.

So there are a few ways to achieve this…

Perhaps the most logical is to create an option set called Yes/No, with display values of Yes and No, and a yes/no attribute for each set accordingly.

Then you can simply use the option set as the dynamic choices of the dropdown, then just refer to the dropdown’s value’s yes/no attribute in your workflow.

Another way, if you’d prefer to work with static text values, is to leave the dropdown with static values of Yes, and No, then in your workflow use the expression: Attendance = Dropdown Yes/No’s value is Yes.

(that basically means the the yes/no value of the Attendance field will be set to Yes when the dropdown’s value is Yes).

Either way will work just fine, but personally I’d use an option set.

1 Like

I really appreciate your answer. I wasn’t able to get the options set to work properly because there is so much logic I need to enter so I went with option two.

Could you explain why attendance = Dropdown Yes/No value is “Yes” works? Is this like a boolean function that inputs “No” if it is set to false?

This option works for me but I am trying to understand why.

Thank you.

When setting a yes/no field in Bubble, you’re basically telling Bubble when to set it to Yes…

So the Value you set needs to evaluate to a yes/no (rather like a condition does).

So, in your case, using the expression I gave in the previous post, you’re telling Bubble to set the yes/no value to Yes, when something is true - in this specific case, that thing is when the dropdown’s selected value is Yes (the static text value). If that’s the case then the value will be set to Yes. If it’s not it will be set to No.

So, if a User selects Yes (the static text value) from the dropdown, then the above ‘condition’ is true (i.e. dropdown’s value is Yes), so that will tell Bubble to set the yes/no value to Yes. If they select No, then the ‘condition’ (is the dropdown’s value Yes) is not true, so the value will be set to No (actually it might not be set at all, I’m not certain how that works off the top of my head - you’d need to double check that it is set - and if not you might need to use a conditional action to make sure it gets set either way if it’s important to you not to have a blank value)

Thank you this makes sense.

Thank you, I spend so much time searching for a solution, this was the simplest answer for me.

1 Like

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