I have a requirement in creating a dependent dropdown list in Sitecore 9 forms. For example one is state and other is country. How to accomplish this?
-
Please try the logic from below blog : madhuanbalagan.com/sitecore-9-forms-custom-grouped-dropdown– SreekrishnanNov 30, 2020 at 12:17
-
Hi, Thanks! But I wanted it on two separate dropdowns, not in one.– Arjun AnilNov 30, 2020 at 12:41
-
@ArjunAnil have you looked at this. sitecore.stackexchange.com/questions/26633/…– Raman GuptaJan 23, 2021 at 11:37
2 Answers
Follow the below mentioned steps:
- Create an API that would return the list of states for the given country.
- Bind a client side function with index change event of dropdown "Country"
- Make a call to the API (#1) and bind the state dropdown.
-
Hi, could you please clarify how I will call the datasource in the sitecore forms dropdown? Nov 30, 2020 at 11:20
-
-
can you take a look at this answer, looks relevant to your case : sitecore.stackexchange.com/questions/26717/… Apr 1, 2021 at 13:15
By dependent I assume you mean when you select country the state list should be the states inside that country not all the states in the world.
If that is the case, Sitecore doesn't support that complex logic out of the box, but you can develop your own Forms Controls.
Please be careful if you created any template in Sitecore forms be sure you have _standard Values with that template, otherwise it will fail silently without an error and you won't be able to know where is the problem is coming from.
If you are estimating you have to aside some slack time as you will stumble upon a lot of situations like that, where it fails silently and you have to figure it somehow by your own.