Welcome Guest, Not a member yet? Register   Sign In
Restricting multiple related dropdowns
#1

[eluser]kimp[/eluser]
I have a data hierarchy that is represented by a muti-dim array and I need to turn this in to several dropdowns. The hierarchy is something like: Division, Subdivision, Group.

In the first dropdown, the user needs a list of Divisions. When the user selects a Division, a list of related Subdivisions should be shown. If the user selects a Subdivision, a list of related Groups should be availabe in the third dropdown.

I have looked into how <optgroup> works when a multi-dim array is sent to the form_dropdown method, however this doesn't work for me since the user may want to choose a Division only, or a Subdivision only.

Any ideas how I can make this work? Key issues seems to be restricting the choices of the second and third dropdown, based on choices made in the first and second dropdown. Perhaps I'll need to use ajax?
#2

[eluser]Atharva[/eluser]
Yes, you can use ajax. You can populate the div for second dropdpwn for onselect event of first dropdown via ajax call (set innerHTML). Using jQuery will make your task easy.




Theme © iAndrew 2016 - Forum software by © MyBB