• rladha

    (@rladha)


    Example: Two drop down fields: Country and State/Province. I would like to display list of Provinces based on the selection of the Country field.

    USA –> California, New York, Texas etc
    Canada –> Ontario, Quebec, etc

    I will really appreciate your feedback!

    thanks

    Rahim

Viewing 4 replies - 1 through 4 (of 4 total)
  • charles godwin

    (@charlesgodwin)

    Have you tested this? I’ll say I haven’t but I expect that if I selected Canada I think the only choices in the state/province column would be provinces, barring any coding errors in the data. I believe the drop downs are dynamically generated from the data in the table.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Guys,

    Interesting topic!

    You need to add some javascript that handles the onchange event of those listboxes. If you want to fill these listboxes with hard coded values, you can just use plain javascript which can be added to your page with the Code Manager.

    If you want to use the values in your database, it is less simple. In that case you need to write a (probably JSON) service that performs your query and handle the result with javascript. You will need to use either one of the action hooks mentioned below to add your logic:
    wpda_before_simple_form
    wpda_after_simple_form

    Does this help (a little)? 🙂
    Peter

    Thread Starter rladha

    (@rladha)

    Thanks, @peterschulznl and @charlesgodwin

    @peterschulznl – I believe, Javascript is the approach because the record is still not saved!

    If you can share a sample or example – I willing to give it a try.

    thanks again — love this plug-in!!

    Rahim

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Rahim,

    Is there a public URL we can visit to see your page? Or can you send me some screenshots?

    Thanks,
    Peter

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Cascading dropdown fields’ is closed to new replies.