If...then...else?

I’m probably thinking about this the wrong way, but I want to display one string as an input’s placeholder text during development and another string in the live version. I suspect the solution involves “Is Development version”, but I’m tripped up as to how to go about it. Can it be done as a single “statement” for the dynamic data of the input’s placeholder?

Hi @sudsy - you could use a custom state. Set up the state with values on page load (see pics below)


image

Then for your input, something like this. I just typed in “Dev Content” and “Live Content” where you’d put whatever appropriate content in those fields.

1 Like

You can use a conditional in your expression for the placeholder like this:

Is Development Version:formatted as text…

This will give you a pop up where you can define what “yes” should look like and what “no” should look like.

THOSE boxes can also have dynamic expressions, so it’s crazy flexible and you can nest things quite easily.

You can do this with any Boolean expression, BTW. (Like instead of printing “yes” or “no”, you can print “cool!” or “not cool!”)

This is also how you can have URLs/links in dev that have correct destination there, and also have correct destination in live mode.

3 Likes

While u can do that, my solution is lots easier (in most cases) and more Bubble-like. :wink:

Thanks @nikolai, I started thinking about custom states but figured there MUST be a simpler way. :confused:

1 Like

Thanks, @keith, that’s the ticket! I created a parameter for the domain portion of a URL in an API call so I can conditionally point to the dev or live server.

Thanks much! :+1:

1 Like

… and even if you hadn’t done that, you can still do it by resolving Is Development Version to the “version-test/” part of the URL (for “yes”) or null string (for “no”).

I believe what you are looking for can be solved using the below. Simply change the output for Yes, and No options separately.

image

Hi @primalm this looks like an extremely helpful feature and I really need it, but I cannot find it anywhere. Was it removed from Bubble?


Here a need to display “Your email is confirmed” if Current User’s “email confirmed” field is TRUE.
Thanks.

Hi @mike.rokosh,

You probably overlooked it. It’s right there in your screenshot - i.e. :formatted as text.

I’m still struggling with IF ELSE statements.

I’m trying to make the following excel formula work:
=IF((D2 * D3)<800000,2000,(0.0025*(D2 * D3)))

So If the product of two variables is < 800,000, the result is 2000. If it’s larger than 800,000 the result is the product of the two variables multiplied by 0.25%.

How can I achieve this?

4 Likes

Hello,

My solution to this is to set a boolean custom state. When you click the button or anyother action the first workflow should be to set that custom state yes/now depending of your fist condition : IF((D2 * D3)<800000

The second action should be executed only if that custom state is yes and then you just set another action when no.

Regards