Javascript reference - Address Autocomplete Widget
AddressfinderPhone.Phone.Widget class
This page serves as a reference for the constructor, methods, options, and events available in the Phone Verification Widget.
Constructor
Parameter | Type | Description | Example |
---|---|---|---|
phoneSelector | String | CSS selector for one or more input elements. | input.phone_number |
licenceKey | String | Your unique licence key. | VYT6FHV6TPQEWNBG4K7Q |
defaultCountryCode | String | Set the default country code | AU |
options | Object | Configuration options, see the Options section below. | {"rules": {"unverified": "block", "message": "Phone number not verified."}} |
Methods
Method | Parameter | Return value | Description |
---|---|---|---|
disable() | - | - | Disables the Addressfinder phone widget. The verification function will stop working until the widget is re-enabled. |
enable() | - | - | Re-enables a disabled Addressfinder phone widget. |
reactivate() | - | - | Executes the verification function on the input value. The Addressfinder phone widget must be enabled. |
setDefaultCountryCode() | country_code:String | - | Set the default country to verify phone numbers against after the Addressfinder phone widget has been initialised. |
Options
Key | Type | Description | Default |
---|---|---|---|
rules.unverified.rule | String | Rule for unverified phone addresses: block , warn or allow | block |
rules.unverified.message | String | Message to display to the user when an unverified phone number is detected. | Phone number not verified. |
rules.countryNotAllowed.rule | String | Rule for phone numbers coming from a country you wish to exclude: block , warn or allow . | block |
rules.countryNotAllowed.message | String | Message to display to the user when a phone number from a country you wish to exclude is detected. | Allowed countries: list of allowed country names. |
rules.nonMobile.rule | String | Rule for non mobile phone number: block , warn or allow . | allow |
rules.nonMobile.message | String | Message to display to the user when a non mobile phone number is detected. | - |
countrySelect | String | CSS selector for the country selector. | - |
container | DOM element | Element into which the loading indicators and error messages are injected. | - |
allowedCountryCodes | String | List of ALPHA-2 country codes you accept a phone number to come from. Separated by a comma, eg AU,NZ | - |
timeout | Integer | How long the API should run before returning an indeterminate connection status. | 10 |
countryMappings | Object | Ability to map HTML select values to a ALPHA-2 country code. View a code example. | Eg: countryMappings: { "AUS": "AU" } |
Events
Events | Callback arguments | Description |
---|---|---|
result:verified | metadata:Object | Fired when the widget receives a response from the API that aligns with the permissions (allow , warn , block ) defined in the widget's rules. e.g. Phone number is verified. |
result:not_verified | metadata:Object | Fired when the widget receives a response from the API that conflicts with the permissions (allow , warn , block ) defined in the widget's rules. e.g. Country not allowed. |
Are you looking for something not documented on this page? Let us know