I am displaying a yes / no field (Is Active) from my data type using Radio Buttons.
I set the default value to Current page’s Thing Is Active: formatted as text with “Yes” and “No”. This works as expected when the value has been set on the database, showing the correct radio button checked.
If the value on the database has not been set, it displays as “No”. I want to display the buttons as unchecked in this case.
PS displaying and saving a boolean value to a data type with a radio button is very confusingly complicated in Bubble.
Radio button might not be the best choice to display yes/no field. Do you have a special reason not to use the checkbox?
@gary.homewood The condition you’re using evaluates to no, you just need to work out a condition that evaluates to empty, no or yes.
For instance it might be a conditional that only triggers when the radiobutton’s thing is not empty.
How would I apply a conditional to the default value of RadioButtons? I can’t see that as an option.
Where I have Current page’s Thing Is Active: formatted as text I can only provide “Yes” and “No” as values
If I look at the App Data, the field is empty. So I’d like to associate the field with the RadioButtons and it would display as unchecked.
@gary.homewood - you’ve just got to think about the question being yes or no. Is Current page’s Thing Is Active? yes=yes, no=no and empty=no.
You’ll have to play around with setting the radiobutton’s datasource as empty, then setting its datasource with a conditional if your Current page’s Thing Is Active yes/no isn’t empty.
@DjackLowCode thanks so much for the help, but I can’t get it to work.
Leaving the default value initially empty works as expected, the radio buttons are unchecked.
I added the conditional:
When Current page’s Thing Is Active
Default value Current page’s Thing Is Active
This works for yes, the radio button is checked
However when the field has been set to no, the radio buttons are both unchecked.
@gary.homewood - yea seems to be a quirk with formatted as text. If you’re happy with lowercase yes/no default on the radiobutton this seems to handle the empty field (Current page’s thing Active?).
Otherwise consider using another data type (e.g. option set) for this yes/no.