City country conditional dropdown

BP Profile Search Forum City country conditional dropdown

  • Author
    Post
  • #11581 Reply
    Roberto
    Guest

    Hi Andrea,

    I use Kleo theme, and I have 2 dropdowns in my registration form: Country and State:
    https://talenton.live-website.com/registro/

    I was able to populate countries and spanish cities with this:
    https://my.seventhqueen.com/docs/general/how-to-add-a-populated-country-list-xprofile/

    I have spent quite days trying to understand how to show spanish cities only when Spain is selected as country, and don’t show cities if another country is selected. We plan to include Portugal cities in the future, so this behaviour should work with any Country, only showing the cities of the selected country.

    I saw some documentation about select2, but I don’t know if it is related with this issue.

    I would be very happy if you could help me, it is my last option to find a way.

    Thank you in advance!!

    #11583 Reply
    andrea
    Plugin Author

    Hi Roberto,

    You, or your developer, could add some JavaScript or jQuery code that hides or shows your State select field based on the choice made in your Country select field.

    I’m not a JavaScript expert, but a search for something like:

    “show/hide form fields based on selected option”

    will provide many useful examples.

    #11600 Reply
    Roberto
    Guest

    Hi Andrea,

    Thank you for your answer, I will come back here to share the solution once I reach it.

    Regards

Reply to: City country conditional dropdown
My Information