Hello,I am looking into a way to create dependent dropdown.
The situation is usual. One dopdows is used to select country and the second dropdown is used to select city. Choices of second dropdown should obviuosly depend on first.
Is there supported way to archieve this in EPiServer?I have found example Here but it requires extending some episrever classes, which is prone to breakage and also it's not generic.Maybe there is supported way to do that in EPiServer 8?Regards,Giedrius
Are you talking about EPiServer Admin/Edit UI where you would need to play around some dojo, or in site page template itself (where end-users are going)?
If latter - these examples may give you some ideas.
I would take a step back and look at the case in question. What is the editor editing?
If it's an address you can count on selecting available cities from some service won't cut it, someone lives on a farm etc. In this case a zipcode database is a more likely candidate. And if so I would only make the editor input a valid zip code and output the city from the database.
If it's a "Find the nearest reseller" case you probably already have master data and don't need to make an EPi editor input anything in relation to contact info.
If it's just a about location, show a map and retrieve a selected coordinate.
Etc etc... A Country => City dropdown need should come way way down.
Giedrius is asking about a technical solution to a common problem - dependent dropdowns - the nature of the content of those dropdowns is irrelevant to the question being asked.
This post has similar code to what you want although it may need to be adapted https://developerschallenges.com/2017/12/30/episerver-how-to-set-a-value-on-the-server-side-and-update-the-all-properties-view/