Set a Dropdown element value with a conditional

Hello, I’m new to bubble so I still have some issue working with my database

Here I have some options depending on what you choosed on the firts dropdown menu

But here I want to set an specific option because there are not any more options so I want to set the value of the second dropdown based on the value of the first to skip the other step because it’s not neccesary to choose because in this case you only have one option.

Hi @felixvelazquez !

You can insert a condition in the Contitional Tab of your second dropdown to check the ammount of options in your Search. If the total is ONE, what means that you have just one option, you change the default value of this dropbox to the : first item of your search.

image

And check the box “This input should not be empty” to get rid of this blank space.

1 Like

Thanks for your answer @rpetribu !!

I’m trying to do how you told me, but the case (I didn’t specified), there are many cases where the option is just one, so I don’t know if this way it will work because I want an specific value for each option but I’m still learning how to use the conditionals.

Thanks again in advance!

Hi @felixvelazquez!

what @rpetribu said is 100% correct, if you apply this condition to every dropdown it will work as you wish. Because it basically tells the dropdown to automatically choose the only available option when the options total is one regardless of what the dropdown is about or the options may be.

Hi @felixvelazquez !

Can you share images of your dropdown’s setup? And tell us precisely tell what you need?

Yes, here it’s the setup of my dropdown

And I tried applying the setup you told me


but it is just working with the first option of my first dropdown

Here it’s the setup of my first drowpdown:

So yeah, the “: first item” it’s working now but only when I choose the first option of my first dropdown.
I want it to do it like that when I choose any of my first dropdown options and the result of the second one will be the first option you have by default (the options are different on the second dropdown depending on the option you selected on the option of you have on the first one (this is working right now))

Thanks in advance!

I am just guessing here ok? Because I don’t know your data base structure. And I am also not seeing what you are doing with these Searches. So help me to help you :sweat_smile:

I think that a “Role” can have many “Puestos”, am I right?

And what you are trying to do is: When you select a “Role” that have only ONE “Puesto”, the second dropdown should show only this “Puesto” (as it is the only available option). Is this what you want?

Can you open this search?

Yes, that’s exactly what I want just as you said! :wink:

Here it’s the search,

Let me know if you need more info about my database or something!
Thank you, @rpetribu!

Ok!

:x: Remove that condition that you created.

And in the default value you will write: Search for Puesto:First Item

Doing this, the first element will always be the first available option (Puesto). And as you market the checkbox to prevent this dropdown to be empty, this will be the only option in your dropdown.

I see! Actually I just solved it with this condition and it is now working as I wished!

Thanks so much for all your help, @rpetribu !
Have a nice day!

1 Like