Hi Bloomreach Community and Jasper,
I’m wondering if it is possible to have dependent dropdowns, where the options of a dynamic dropdown can be influenced by the selection of another one. e.g. Dropdowns for country and then city. The options would come from an external service call. If not directly out of the box, would it be possible to achieve this with some custom code?
Thanks and kind regards, Andy.
Hi,
The standard DynamicDropdown supports this case, by matching observableId/observerId
configuration, see this configuration doc.
To get values externally, you can write a custom implementation of IValueListProvider, configured as sibling of /hippo:configuration/hippo:frontend/cms/cms-services/DocumentValueListProvider, and reference its id in the valuelistProvider
configuration.
HTH
Jeroen
1 Like
Hi Jeroen,
Thank you for the help, that was exactly what I was looking for!
In addition, would it be then possible to observe multiple previous dropdowns?
E.g. we have three dropdowns: country, city, and street. Street depends both on the country and the city. How would that work?
It seems that the dropdown can only observe one other dropdown. So, would the city dropdown’s keys have to contain information about the country? Like instead of NL, BE, IT, DE, etc., we would have to encode the country into the city entries’ keys: EU-NL, EU-BE, EU-IT, EU-DE and then in the provider decode both the country and the city from the key.
Would this work or is there a better solution? Thank you in advance!