# Set a Dropdown element value with a conditional

**URL:** <https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095>\
**Category:** Database\
**Created:** [June 13, 2022, 6:59pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095 "2022-06-13T18:59:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![felixvelazquez](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@felixvelazquez](https://forum.bubble.io/u/felixvelazquez)\
**Post date:** [June 13, 2022, 6:59pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/1 "2022-06-13T18:59:35Z")

</div>

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

 ![Screenshot_1](https://us1.discourse-cdn.com/bubble/original/3X/3/a/3ab6362c67e246cb15334bc5104c8d669c12bb76.png)

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.

 ![Screenshot_2](https://us1.discourse-cdn.com/bubble/original/3X/f/0/f00956afd6f1b66a245d202ed016abd47f6dab89.png)

---

<div class="post-metadata">

**Author:** ![rpetribu](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rpetribu/32/90852_2.png) [@rpetribu](https://forum.bubble.io/u/rpetribu)\
**Post date:** [June 13, 2022, 7:12pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/2 "2022-06-13T19:12:50Z")

</div>

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](https://us1.discourse-cdn.com/bubble/original/3X/c/4/c42ed893cdabca0f1f07f72be2b664e8b71a220d.png)

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

---

<div class="post-metadata">

**Author:** ![felixvelazquez](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@felixvelazquez](https://forum.bubble.io/u/felixvelazquez)\
**Post date:** [June 13, 2022, 7:53pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/3 "2022-06-13T19:53:18Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/a/2/a228a17716925548ec3cc2cf7f225e330355418d.png)

Thanks again in advance!

---

<div class="post-metadata">

**Author:** ![hanan1](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/hanan1/32/111158_2.png) [@hanan1](https://forum.bubble.io/u/hanan1)\
**Post date:** [June 14, 2022, 7:39am UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/4 "2022-06-14T07:39:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rpetribu](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rpetribu/32/90852_2.png) [@rpetribu](https://forum.bubble.io/u/rpetribu)\
**Post date:** [June 14, 2022, 11:27am UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/5 "2022-06-14T11:27:51Z")

</div>

Hi @felixvelazquez !

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

---

<div class="post-metadata">

**Author:** ![felixvelazquez](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@felixvelazquez](https://forum.bubble.io/u/felixvelazquez)\
**Post date:** [June 14, 2022, 2:23pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/6 "2022-06-14T14:23:10Z")

</div>

Yes, here it’s the setup of my dropdown

 ![puesto1](https://us1.discourse-cdn.com/bubble/original/3X/4/7/47d54d8c996ea74eae541d52dd0e090633fa932d.png)

And I tried applying the setup you told me

 ![dropdown2](https://us1.discourse-cdn.com/bubble/original/3X/3/3/33337aa1883972c725eeb59d8c9852670933f1ab.png)  
but it is just working with the first option of my first dropdown

Here it’s the setup of my first drowpdown:

 ![dropdown rol](https://us1.discourse-cdn.com/bubble/original/3X/3/3/33f9c7d7eb6184d0171a49486e6b2777d1657e69.png)

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!

---

<div class="post-metadata">

**Author:** ![rpetribu](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rpetribu/32/90852_2.png) [@rpetribu](https://forum.bubble.io/u/rpetribu)\
**Post date:** [June 14, 2022, 2:37pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/7 "2022-06-14T14:37:38Z")

</div>

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 😅

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?

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/7/d/7def40b9e62f55e686e94c6bf3fe2dd2dacb2b17.png)

---

<div class="post-metadata">

**Author:** ![felixvelazquez](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@felixvelazquez](https://forum.bubble.io/u/felixvelazquez)\
**Post date:** [June 14, 2022, 2:51pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/8 "2022-06-14T14:51:23Z")

</div>

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

Here it’s the search,

 ![dropdown3](https://us1.discourse-cdn.com/bubble/original/3X/4/b/4b6ce233df0c5a8dab15209a5994b6d294d54177.png)

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

---

<div class="post-metadata">

**Author:** ![rpetribu](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rpetribu/32/90852_2.png) [@rpetribu](https://forum.bubble.io/u/rpetribu)\
**Post date:** [June 14, 2022, 7:01pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/9 "2022-06-14T19:01:51Z")

</div>

Ok!

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/9/f/9fdb638a67cfda367bb6cedb4b573a2ae220fcbe.png)

❌ 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.

---

<div class="post-metadata">

**Author:** ![felixvelazquez](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@felixvelazquez](https://forum.bubble.io/u/felixvelazquez)\
**Post date:** [June 14, 2022, 7:11pm UTC](https://forum.bubble.io/t/set-a-dropdown-element-value-with-a-conditional/211095/10 "2022-06-14T19:11:47Z")

</div>

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

 ![solution](https://us1.discourse-cdn.com/bubble/original/3X/7/0/70b55f90f42d92cb1563a792d6dbf82a4671021c.png)

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