Search.../

value

Sets or gets the value of the address input.

Description

The value of an address input is an object of type Address.

The Address object's data will differ depending on the site visitor's input method:

  • Site visitor enters free text in the address input: Only the Address.formatted property will contain data.
  • Site visitor selects one of the Google address suggestions: The Address.formatted property and all relevant Address properties that correspond to the selected Google address will contain data.

You cannot modify the value object in-place. To change the value of an address input, do the following:

  1. Store the value object's data in a variable.
  2. Make changes to the object.
  3. Reset the value property with the modified object.

Notes:

  • If an address input is connected to a dataset, setting the address input's value in code does not set the value of the connected field in the dataset. That means if you use the dataset to perform a submit, the value changed in code is not reflected in the submitted item.

  • To submit the new value using a dataset, set the field's value using the setFieldValue() function before performing the submit.

Type:

AddressRead & Write
NAME
TYPE
DESCRIPTION
formatted
string

Address in human-readable format. The formatted address is displayed in the address input element.

location
AddressLocation

Address coordinates.

streetAddress
StreetAddress

Address street name and number.

city
string

Address city.

subdivision
string

Address subdivision of a country, such as a state or province.

country
string

Address country.

postalCode
string

Address postal code.

Was this helpful?

Get an address input's value

Copy Code
1let address = $w("#myAddressInput").value;
2
3/* {
4 * "formatted":"500 Terry A Francois Blvd, San Francisco, CA 94158, USA",
5 * "location": {
6 * "latitude": 37.7703718,
7 * "longitude": -122.38712479999998
8 * },
9 * "streetAddress": {
10 * "name": "Terry A Francois Blvd",
11 * "number": "500"
12 * },
13 * "city": "SF",
14 * "subdivision": "CA",
15 * "country": "US",
16 * "postalCode": "94158"
17 * }
18 */
Set an address input's value

Copy Code
1let address =
2 {
3 "formatted":"500 Terry A Francois Blvd, San Francisco, CA 94158, USA",
4 "location": {
5 "latitude": 37.7703718,
6 "longitude": -122.38712479999998
7 },
8 "streetAddress": {
9 "name": "Terry A Francois Blvd",
10 "number": "500"
11 },
12 "city": "SF",
13 "subdivision": "CA",
14 "country": "US",
15 "postalCode": "94158"
16 }
17
18$w("#myAddressInput").value = address;
Set an address input's value using the "formatted" property

Copy Code
1let address =
2 {
3 "formatted": "500 Terry A Francois Blvd, San Francisco, CA 94158, USA"
4 }
5
6$w("#myAddressInput").value = address;
Edit an address input's value

This example retrieves the value of an address input, adds a postal code to the address, and then overwrites the old value.

Copy Code
1let address = $w("#myAddressInput").value;
2address.postalCode = "94158";
3$w("#myAddressInput").value = address;
4