• Hello,

    I have created a search form with multiple dropdowns:
    – 1 category dropdown (works fine)

    2 taxonomy dropdowns in which:
    – dropdown 1 shows the mother taxonomies(works fine as well)
    – dropdown 2 shows the child taxonomies.

    I have 2 main taxonomies (Country 1, Country 2) and they all have their necessary childs (states).

    Now I want to fill the second taxonomy dropdown depending on the choice at the first taxonomy dropdown. So if someone chooses country 1 it should state the childs of country 1, while when someone chooses country 2it should state the childs of country 2.

    I know I should use javascript for this but unfortunately my capabilities in javascript are limitted. Anyone that can help me out on this one?

    Thanks a lot in advance.

    Joost

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter JoostJoost

    (@joostjoost)

    Found a solution. works fine now 🙂

    Moderator bcworkz

    (@bcworkz)

    In the country select element, set the onchange event equal to your function that will populate the state select/option elements. When the event fires and your function is called, use document.getElementById("idCountry").selectedIndex to get which option number was selected. Based on that, set document.getElementById("idState").innerHTML to equal the option html for the states associated with the country selected.

    Hi I am having the same dilema, can you share your solution if you don’t mind please? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Populate category dropdown based on choice first dropdown’ is closed to new replies.