Address

Collects an address, including street, state and postal code.

Unlike most answers, a default address answer value is stored as an object, since it contains multiple parts.

{
  "my_address": {
    "address_1": "213 Main St",
    "address_2": "Apt 17",
    "city": "Kansas City",
    "state": "MO",
    "postal_code": "64116"
  }
}

Need only the town / city? See the Region question type.

If you would like to access one of the parts of the address in a string template, you may use the get template function.

Given the above example, a template like:

Great, your postal code is {{my_address | get 'postal_code'}}.

Would render:

Great, your postal code is 64116

Use Single Field

When this option is enabled, Formsort will provide a single input field for the user address, rather than distinct input fields for street address, city, state, and zip.

The payload for a single field address is a little different than the default, since the data type is considered string instead of an address object. This means the address details will come in as one "raw" property in the address object.

{
  "my_address": {
    "raw": "213 Main St., Apt 17, Kansas City, MO 64116"
  }
}

International addresses

If you enable International?, then responders will be allowed to choose the country of their address. The saved address will contain the country that was selected.

{
  "my_international_address": {
    "address_1": "StrahovskΓ© nΓ‘dvoΕ™Γ­ 301",
    "city": "Praha",
    "postal_code": "118 00"
    "country": "Czech Republic"
  }
}

Default

When international addresses are enabled, you can set a default country using Default country.

Setting Address via URL parameter

If you'd like to pass an address into the flow for your user, here is an example of the syntax required for the address component at the top of this section. Notice each [field] corresponds to an object key from the example.

You can set all the address fields, or just the fields you have (or want to use).

Default address component syntax:

https://your-flow-url.com?my_address[address_1]=213+Main+St&my_address[address_2]=Apt+17&my_address[city]=Kansas+City&my_address[state]=MO&my_address[postal_code]=64116

Single-field address component syntax:

Since the Single-Field address string will require commas, you may have to URL encode the address before passing it in as a value for the parameter.

https://your-flow-url.com?my_address[raw]=123%20Main%20St%2C%20Apt%2017%20Kansas%20City%2C%20MO%2C%2064116

See URL Parameters for more information on passing answers in to a flow.

Autocomplete using Google Places API

Addresses are sometimes tedious to type, so you can use the Google Places API to auto-complete addresses, by providing your API key.

If you are restricting referrers and/or embedding your Formsort flow, make sure to add flow.formsort.com (which is where your flow will be hosted) to the list of allowed referrers in the Google API console, in addition to any custom domains on which you are hosting your flows.

Whitelisting flow.formsort.app may be necessary for use of the Places API in the Live Preview as well!

When enabled, the address answer will also contain a raw field which stores the raw string that was entered by the user.

{
  "my_address": {
    "raw": "213 Main St., Apt 17, Kansas City, MO 64116",
    "address_1": "213 Main St",
    "address_2": "Apt 17",
    "city": "Kansas City",
    "state": "MO",
    "postal_code": "64116"
  }
}

Validating form addresses with USPS

This feature is only available for addresses in the United States.

When Validate addresses (US only)? is enabled, USPS web tools will be used to verify that the address is a valid US mailing address, once you provide your API credentials for USPS.

Last updated