Forum Documentation Showcase Pricing Learn more

Does a yes/no variable default to 'no' if it is not defined?

I’m checking for the value of a yes/no variable. If the value is ‘no’, I’d like to show an “X” icon.

In the conditional code for the “X” icon, I say that when the value of this variable is ‘no’, make the “X” visible. By default, it is not visible.

However, even when this variable doesn’t have a value, it seems to be interpreted as a “no”.

Any insights into solving this?

Thanks.

that’s weird.
Would you mind reproduce it on the public forum app so we can help ?

Oh, good to know that there is a public page for these kinds of things now.

I set up something at: https://bubble.io/page?type=page&name=laf&id=forum_app&tab=tabs-1

The icon that you see, you shouldn’t, because it should only be visible when the Current User’s booleanVar is set to “no”. But you can see it.

Sorry I didn’t understand your first post. That is the expected behavior actually
it’s because by defaut, Yes/No field are considered like a NO since it’s empty when created
That make sense ?

2 Likes

I see, thanks for the info.

In that case, would you happen to know how I can make the icon visible only when:

  • The field is not empty AND
  • The field value is “NO”

I tried using multiple conditions, but there doesn’t seem to be a condition for when a boolean variable is not defined. There is only:

  • is it Yes?
  • is it No?
  • “:formatted as…”

This functionality (where an icon is visible or not based on the value of a boolean variable) is important in our app, so any help would be great.

BTW, are you part of the official Bubble help team, or just a helpful community member? I ask because our account comes with 2-day support and it may be time to describe this issue to the Bubble team, depending.

Thanks.

For a boolean, this is nomal : EMPTY <=> NO
When the new Thing containing your boolean is created, can’t you just define value =yes ?
I’m just helping.

I see; thanks for being helpful.

If I define the value = yes, then the icon will show. That should only happen when the user has taken a particular action. I set the boolean to be yes once the user takes that action.

PS: I’m checking with the bUbble team to see if they can chime in. I’d like to avoid using two booleans, plus there is the matter of porting all the existing data that I already have.

Not sure we want to operate a change there. Our boolean value is indeed ‘empty’ == false, and i think we’ll keep it like this. So in this case, you probably need too booleans.