Hi All
Looking for some general input rather than a solution to a specific problem.
In my account (user details) page, for location I have country, state, city, and postcode. Ideally what I would like is dropdowns for each, so a user selects Canada, then under the second dropdown only a list of Canadian states would appear. City is probably trickier, and will need to be free text. And then finally, postcode would be another dependent dropdown depending on what state was selected.
We see this sort of set up on websites all the time, just wondering where to start. I gather I am going to need to get a full list of states, postcodes, etc and populate some tables. This is definitely a ‘nice to have’ on my app, so before I began, thought I would ask!?
Thanks
Paul
1 Like
Want it too. There’s no API working good, for me!!! ^^
Hi Prajwal
This was great. Just in case anyone wants to do it with an API. I created a table with two columns, ‘country’ and ‘state’.
The API is GET and named UserLocation. My data variable is called UserLocation1.
The formula for the country dropdown is;
UNIQUE_BY_KEY(MAP(data.UserLocation1, {label:item.country,value:item.country} ),“label”)
The formula for the state dropdown is;
MAP(SELECT(data.UserLocation1, item.country==pageVars.Country), {label:item.state,value:item.state} )
Works great. I was confused for a while because I had an issue with pagination on the API, so not all records were appearing…but you will see on this forum, pagination issues are frequent depending on what back end you use.
Thanks
Paul