Address field
Description
The address field is used to collect structured address information from the user. It allows the user to search for their address, and select it from a list of suggestions. Then the field is expanded to show the different address components like street, city, state, postal code, and country.
User experience
The address field initially shows a single input for the user to enter their address. As the user types, the field suggests matching addresses from a database of known addresses.
When the user selects an address from the search results, the field is expanded to show the different editable address components.
Address components
The address field collects the following components:
- Line 1: The first line of the address, typically the street address.
- Line 2: The second line of the address, typically the apartment or suite number.
- City: The city or locality.
- State / Province / Region: The state or region.
- Postal code / Zip: The postal code.
- Country: The country.
Address components can be used in the following ways:
- Field references: You can reference the address components in other fields, like in a confirmation message, or in a hidden field. Example: Show the user’s city in a confirmation message.
- Conditional logic: You can use the address components in conditional logic to show or hide fields based on the user’s address. Example: Show an error message if the user’s country is not supported.
- Calculations: You can use the address components in calculations to calculate shipping costs, or tax rates based on the user’s address. Example: Calculate the shipping cost based on the user’s country.
Configuration
- Show address line 2: You can choose to show or hide the second address line (Line 2). This is useful if you want to simplify the form for users who may not need to enter an apartment or suite number.
- Require postal code: You can choose to make the postal code required or optional. This is useful if you want to ensure that users provide a postal code for their address.
- Restrict address to: You can restrict the address field to specific countries, or allow all countries. This is useful if you only ship to certain countries, or if you want to collect addresses from all over the world.
Notes
The address field allows you to access individual address components, or a formatted full address. The formatted full address will use the appropriate format for the selected country.
Not all components are available for all countries. For example, state / province selection is not displayed for countries like Singapore and United Kingdom.
The address field uses Open Street Map (OSM) for address suggestions. OSM is a free and open-source map database that is maintained by a global community of contributors. The address suggestions are based on the user’s input, and are not stored or shared with OSM.
