Address Search Component

 

Overview

The Address Search component offers your end-user a Google Maps-style address lookup by using an external address service setup in Services Administration. In Express View, end-users use the Address Search component to search for addresses by entering partial or related search terms.  As end-users type a portion of an address, a list of the closest matches displays. Selecting the closest match auto-populates the address fields.

To learn more about implementing address service into the Address Search component, visit our Enabling Address Search Using Address Services article.

This Address Search component offers the following flexibility with collecting and using address information:

It is the customer/creator's responsibility to obtain an API key for the Google Places or Canada Post services. API Keys are owned by the customer and should not be exposed to end-users.

You'll find the Address Search component in the Secondary Fields group to the left of the Module Builder.

To learn more about general component settings and those that display when a component is associated with Data Models, view our General Component Settings article.

Field Text

A static image displaying the Address Search component's Display settings.

Settings Description

Label Text

The Label Text field conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field.

Use user-friendly labels to make your module accessible. It's best practice to use brief and descriptive labels (one or two words). Use title case for short entries and sentence case for long entries.

Placeholder Text

A short prompt telling end-users the expected value of an input field. For example: Enter your Social Security Number. Placeholder Text displays inside the input field until the end-user begins an entry.

Contextual Help

Settings Description

Tooltip

A short hint that displays when an end-user positions their cursor over the Questionmark Icon (Tooltip) icon. Tooltips can display across more than one line.

Default State Options

Settings Description

Disable User Input

When set to ON, end-users can’t interact with or edit the Express View's input field or element. When end-users hover over the field, their cursor changes to alert them to the status change.

By default, the Disable User Input toggle is set to (OFF).

Read Only View

When set to ON, the component is display-only. If another component pushes content to the field, the end-user sees that content. Otherwise, end-users see the word None.

If the service type is set to Canada Post, Read Only View hides or suppresses the Country Option drop-down. This action occurs even if the Show Country Option setting is  (ON). The Country Option drop-down does not contain submission data to display.

By default, the Use Read-Only View/Read Only View toggle is set to (OFF).

Hide Field

Hides the component from displaying in Express View.By default, this setting is (OFF).

Formatting

Settings Description

Address Display Options

These settings enable end-users to see or enter their address information. If your end-user uses the search field and selects a suggested address, this field auto-fills from the address data returned by the address service API. Any end-user edits made to this field are only saved in this field's submission data and do not affect data returned by the address service API.

By default, end-users can edit checked fields. Enable Disable User Input to require users to use the search field to populate the Address Display fields. To prevent users from using the Search field, enable Hide Search in Advanced Settings.

By default, the following options are set to (OFF).

Show Street

Set to  (ON) to display the address field in Express View. Street Address includes building number and street address values.

Show Street 2

Set to  (ON) to display the secondary street address field in Express View. Secondary street address information might include building floor and office space values.

Show City

Set to  (ON) to display the City field in Express View.

Show State

Set to  (ON) to display the State field in Express View. State information might include individual U.S. state locations, territories, or sub-regions of a country.

Show Zip

Set to  (ON) to display the Zip code field in Express View.

Show Country

Set to  (ON) to display the Country field in Express View.

No Matching Results Text

Enter a custom message to display when an address service API has no matching search results based on the end-user's search.

Loading Results Text

The value in this field displays to the end-user when the Address Search component retrieves results from an address service.

Hide Search

Set to  (ON) to hide the address search function. The Address Search component will not communicate with the Address Service API and perform an address lookup. Instead, the address fields you select display in Express View. Your end-user can then manually type in their address details.

By default, this setting is (OFF).

In this example, configure an Address Search component using the Google Places API to collect your end-user's address data. Let's assume the end-user lives in the United States. That way, you don't need to include the Country field. Also, add Placeholder text so your end-user knows to use the search field.

These instructions assume that you have an open module saved with a title.

1. In the Module Builder, drag and drop an Address Search icon Address Search component onto your canvas.
2. In the Property ID field, enter address.
3. In the Label Text field, enter Address.
4. In the Placeholder Text field, enter Search for your address.
5. Set the Show Street, Show Street 2, Show City, and Show State to  (ON).
6. Navigate to the component's Data settings.
7. From the Select API drop-down, select Test Google Places API or a Google Places API configured for the environment.

Test Google Places API is a preconfigured address service for the Training environment. To learn how to implement address service into the Address Search component, visit our Enabling Address Search Using Address Services  article.

A static image displaying the Address Search component. The Select API dropdown is highlighted.

8. Click Save Component.
9. Save your module.

Preview your module in Express View and search for an address:

Using the example above, in Express View, execute the AngularJS command in the DevTools Console. The address Address Search icon Address Search component stores selected options in an object when viewed in the developer console. If no options have been selected, then the array is empty. In the address object, location data is stored in arrays and key/value pairs. The Address Search component returns the full, unaltered address from the address service in the formatted key. All other address response data is specific to the Google Places or Canada Post API. Address Service APIs return all location data regardless of the Address Display Field (Street, Street2, Zip, Country) selections.

In Express View, if no address service is selected, the console returns the status code error: 404 (Not Found). The console log also warns you to select a valid service.

Google Places Response Data

Google Places also returns data that includes: geometry, place_id, and location types. The Google Places API returns the following response when searching for the Unqork address:

Short Format Data

Enable the Short Format Data (Google Places) setting to store record data in an abbreviated format. This setting only affects the address element fields (street, street2, city, state, zip, and country). The Google Places API returns the following response when searching for the Unqork address:

address_components Data

For detailed location data, refer to the address_components array. The address_components array is useful when viewing international locations that don't follow the strict US-centric format:

  • City, State

  • Zip Code, Country

The address_component location data includes the long_name key, short_name key, and types array for each address field.

A static image displaying the address_components array data.

Canada Post Response Data

The Canada Post API returns the following response when searching for the address 85 5th Ave Frnt 1, New York, NY:

Resources