Callbacks
Address Lookup also provides callbacks which let you hook the following events:
Address Fields Populated
Invoked after the selected address is applied to input fields.
Full Address Retrieved from API
Invoked when the Address Lookup client has retrieved a full address from the API following a user accepting a suggestion. The first argument is an object representing the address that has been retrieved.
User Selects an Address Selection
Invoked immediately after the user has selected a suggestion (either by click or keypress). The first argument is an object which represents the suggestion selected.
Address Lookup field is De-Focused
Invoked when the user unfocuses from the address input field.
Address Suggestion List Closes
Invoked when Address Lookup suggestion box is closed (i.e. hidden from user).
API Key Check Fails
Invoked function invoked if checkKey is enabled and the check fails.
Address Field is Selected
Invoked when user selects or focuses address input field.
User inputs into Address Lookup Field
Invoked when user edits Address Lookup field
User Presses a Key
Invoked when keypress is triggerd on input.
Address Lookup Successfully Loads
Invoked when Address Lookup has been successfully attached to the input element.
Address Lookup is Mounted to DOM
Invoked when controller attaches to the DOM (controller.view.attach()).
User Clicks on Suggestion List
Invoked when mousedown event is triggered on suggestion list
Address Suggestion List Opens
Invoked when Address Lookup suggestion box is opened (i.e. presented to the user).
Address Lookup Detaches from DOM
Invoked when controller detaches from the DOM (controller.view.detach()).
Full Address Retrieval Fails
Invoked when an error has occurred following an attempt to retrieve a full address. In this scenario the user will also receive a message to manually input their address.
The first argument is an error instance (i.e. inherits from Error) representing the error which has occurred.
Examples of errors includes "lookup balance exhausted" and "lookup limit reached" errors.
Address Suggestion is Selected
Invoked when a suggestion has been selected.
Address Suggestion Retrieval Fails
Invoked when an error has occurred following an attempt to retrieve suggestions for a key press. In this scenario the user will also receive a message to manually input their address.
The first argument is an error instance (i.e. inherits from Error) representing the error which has occurred.
Examples of errors includes "lookup balance exhausted" and "lookup limit reached" errors.
Address Suggestions Retrieved from API
Invoked immediately after address suggestions are retrieved from the API. The first argument is an array of address suggestions.
Hidden Address Fields are Unhidden
Invoked when hidden fields are unhidden (i.e. user selects an address or opts for manual input)