Automatically Populate Country and State Dropdowns

Digioh App Marketplace

In the Digioh editor, if you want to have “Country” dropdown, normally you would have to enter each country as a field value, potentially more than 200!

To save you the time and effort, you can instead install App #60 – Country Drop Down. Then, by configuring some metadata on your dropdown fields the app will automatically populate specific drop downs with country and/or state information. Note that the app currently only supports US States. Also, this auto-populate only works with fields of type “Dropdown”.

To auto-populate a dropdown, you set metadata commands country_auto and (optionally) state_auto on the appropriate Custom Fields. For more information on how to set metadata, read this introductory article: How do I add Metadata.

For both country_auto and state_auto metadata command keys, valid values are “name” or “code”. The user visible values are always the same, but if you configure “name” then the submitted value will be the full name e.g. “United States of America”, whereas “code” will submit “US” (the ISO alpha-2 code). Similarly for states: California vs. CA.

You can also populate country_auto metadata with value “phone-prefix”, to show phone prefixes to select for instance the country code filling a phone number. The submitted value will be the number with the extra + at the beginning.

Country drop down configured to submit name:

Note the empty value for the default “Select your country” option. This is important if you want to make the dropdown a required field. Digioh will reject blank submit values for required dropdowns.

State drop down configured to submit code:

For non-US countries, the app will automatically hide the State field (if present and configured with metadata state_auto):

Running into an issue or have a question? Reach out to our support team via support@digioh.com and we’ll be happy to help!