Skip Navigation

[Resolved] Country and City Drop Down

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 5 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#1088199

For user registration I have created User Form. I want to add two drop down(Province and City). I want to populate data automatically. Default Country is "Canada". So Province and City should be populate automatically.

#1088365

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Henry

There is no such option, I'm afraid.

You can create taxonomies or custom fields for province and city, but you need to set the options up yourself.

There is a filter—wpt_field_options—that can be used to dynamically populate a custom field select dropdown, but you need to provide the values and display values in the required JSON format, so you would still need to provide the values from somewhere.

Alternatively you could add a Maps address field where the user enters either a full address or a partial address, such as Toronto, Ontario, chosen from the Google autocomplete.

The formatted address would be stored as a text field.

Google returns more than just the formatted text field, but we don't use anything else apart from the lat/lon coordinates, though it is possible to add some custom JS to extract different parts of the address for your own use.

In this linked thread I gave an example of extracting the zip code, while another user added a more generic example to extract all available fields: https://toolset.com/forums/topic/separating-content-from-the-address-field/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.