I’ve spent the past few months working heavily with Drupal, rebuilding my company’s primary site on it. While doing this, I came to an interesting issue that involved creating a module that I think the Drupal community at large could use – a new form item type for choose a state, with a full country list as well. To solve this issue, I created the statepicker module, which is currently hosted on Drupal.org as a sandbox project, but I hope to have it upgraded to full project status shortly.
Statepicker creates a new field type, called ‘statepicker’, that creates a pair of dropdown menus in the form – a state dropdown and a country dropdown. When the country dropdown is changed, an AJAX call refreshes the state list to show the states from the current country. I’ve also created an administration panel that lets an admin edit the state list.
You can download the module from the Drupal.org site, currently only through the repository viewer.