2

I am using Address field module to populate address. A requirement needs to limit cities to a particular set, and also countries to particular set too. so I would like to present a set of cities in drop down list based on country selection. From the answer here I could figure out that something has to be done in plugins but I could not figure out what exactly. If anyone has sample code for city drop down in Address Field modules's plugins it would be of great help!

1

Consider using the Select (or other) module. Here is an excerpt about it from its project page.

Provides a new Forms API element which is a select/radios/checkboxes element that has an 'other' option. When 'other' is selected a textfield appears for the user to provide a custom value.

So basically you could "start" from a few cities (City 1, City 2, City 3), and whenever somebody needs another one (not in the list yet), they just enter "City 4". Here is a sample about it (just replace "Option" by "City" to get the idea):

enter image description here

  • Any feedback about this answer? did you get it to work? – Pierre.Vriens Aug 27 '15 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.