Dropdown Menu Condition

I’m trying to build a form that starts with two dropdown menus. The thing is that the second’s choices depends on the first’s answer. I would like to get t US State related to the city… but now I’m getting all city even tough I select one US State. Where and how can I use the condition in the second dropdown menu (City)
Any ideas how to enter coding?
Thank you

Hey @axel.schallies

Sounds like both your dropdowns should be dynamic. How are you getting the data to match a city to a state? Is it via your DB or via API?


Need extra help?

Book a free 15 minutes call - happy to help if I can

Hi @ambroisedlg,
Both dropdowns are dynamic and I’m using my own DB. How can I connect them?


I’m not sure if you did this already, but in your DB you’ll need to have a data type ‘City’ and a data type ‘State’, which needs to include a field ‘Cities’ (list of Cities).

Set your first dropdown to data type = States and data source = Search for States (no constraints)
Set your second dropdown to data type = Cities and data source = Search for Cities, constrained by City is in Dropdown State’s Cities

Here is a quick example:
Demo: https://ambroisetestapps.bubbleapps.io/version-test/dynamic-dropdowns?debug_mode=true
Editor: https://bubble.io/page?type=page&name=dynamic-dropdowns&id=ambroisetestapps&tab=tabs-1

Hope that helps

Need extra help?

Book a free 15 minutes call - happy to help if I can

1 Like

Yes, this works… I need to tweak my DB but I can see the settings.
Thank you… :slight_smile:

is there an api for this? i want to provide a dropdown list with states and cities. I dont want to manually enter every city in a state. Is there any api which does this?

I just saw your message… What I did I change field type of choice to text. This way it will grab & show only one the state from my database… I hope this helps