Company
Date Published
Author
Bubble
Word count
736
Language
English
Hacker News points
None

Summary

We're going to build an app with dynamic dropdown elements that depend on each other. We'll create a simple country/city example where the options of the second dropdown are determined by the content of the first one, and display a picture of the selected city. To achieve this, we define our data structure in an 'admin' page, creating two types of things: Country and City. We build forms for each type, with dynamic choices for the country dropdown, allowing users to select from a list of already created countries. When a user saves a city, it is associated with the selected country. In the customer-facing page, we add two dropdown elements for country and city selection, with dynamic options that search through saved data. The second dropdown only displays cities in the selected country, and an image below them shows a picture of the selected city, retrieved dynamically from the 'City' form.