Skip Navigation

[Résolu] Country and City Drop Down

This support ticket is created Il y a 6 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Nigel Il y a 6 années et 3 mois.

Assisté par: Nigel.

Auteur
Publications
#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

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: 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/