Address fields provides the necessary inputs for entering an address. This means you can add all the inputs for an address with a single click instead of adding, renaming, and formatting multiple fields.
Standard field options
An address field has the following field options:
Field-specific options
Address Type
If you would like to remove the Country dropdown or only show US States, go into your Address field's options and scroll down to Address Type.
There are three address types that can be used.
- International will include the Country dropdown. This will be selected by default.
- United States will not include the Country dropdown. The State field becomes a dropdown field with only US states.
- Other - exclude country field will not include the Country dropdown.
Insert placeholders
If you would like to add placeholders to the address inputs, follow the steps below.
- Go to your form Build page.
- Select the address field where you would like to insert a placeholder. In the field options, go to the Advanced section and insert your desired placeholder text in the address fields.
- Save the form and click Preview. Now when the user opens the form, the address fields will show the placeholder text. When they start typing in the address fields, the placeholder text will be cleared.
- For more information on placeholder text, visit the Placeholders page.
Insert default values
If you would like to add default values to the address inputs, follow the steps below.
- Go to your form Build page.
- Select the address field where you would like to insert default values. In the field options, go to the Advanced section and click the menu icon. This will automatically open the Smart Default Values settings where you could search for default values.
- Save the form and click Preview. Now when the user opens the form, the address field would be dynamically populated with the default value.
- For more information on default values, visit the Default Values page.
Address autocomplete
Learn how to use Formidable Geolocation for address autocomplete for better accuracy and more consistent data.
Display address fields
If you would like to display specific data from an Address field, insert the following shortcodes into a View or email. In all the examples, replace x with the field ID/key of the address field.
- Display the address field:
[x]
- Display the first line of the Street Address:
[x show="line1"]
- Display the second line of the Street Address:
[x show="line2"]
- Display the City:
[x show="city"]
- Display the State:
[x show="state"]
- Display the Zip Code:
[x show="zip"]
- Display the Country:
[x show="country"]
- Display the Country code:
[x show="country_code"]
Related customizations
Country dropdown list
If you would like to change the countries included in the Country dropdown, insert the following code in the WPCode plugin or a child theme’s functions.php file. Replace Ireland and England with the countries you would like to include.
add_filter( 'frm_countries', 'change_countries'); function change_countries( $countries ){ $countries = array('Ireland', 'England'); return $countries; }
If you would like to add to the existing country dropdown list instead of replacing it, or want the most used countries at the top of the list, insert the following code. Replace United Kingdom and United States with the countries you would like to include.
add_filter( 'frm_countries', 'add_countries'); function add_countries( $countries ){ array_unshift($countries, 'United Kingdom', 'United States'); return $countries; }
State dropdown list
If you would like to add a state to the US States dropdown, insert the following code in the WPCode plugin or a child theme’s functions.php file. Replace Puerto Rico with the state you would like to include.
add_filter( 'frm_us_states', 'add_states'); function add_states( $states ){ array_push($states, 'Puerto Rico'); return $states; }
State abbreviations
If you would like to show the states' abbreviations instead of their full names, insert the following code in the WPCode plugin or a child theme’s functions.php file.
add_filter( 'frm_us_states', 'frm_us_state_abbreviations'); function frm_us_state_abbreviations( $states ){ $states = array( 'AK', 'AL', 'AR', 'AZ', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'GA', 'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME', 'MI', 'MN', 'MO', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM', 'NV', 'NY', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VA', 'VT', 'WA', 'WI', 'WV', 'WY'); return $states; }
Related developer hooks
- Change the labels in an address field with the frm_combo_dropdown_label hook.
- Remove the second line of the street address with the frm_address_sub_fields hook.