Code examples
Having trouble? Send us an email at support@addressfinder.com, and we will have a look. Be sure to include a link to your website, so we can see the page with the problem.
JavaScript libraries
- JavaScript: View on CodePen
- JQuery: View on CodePen
- React: View on CodePen
- Angular: View on CodeSandbox
- Vue: View on CodeSandbox
Capturing Address metadata such as GPS coordinates, LGA, Meshblock and SA1
Demonstrates how to collect GPS coordinates, LGA name and type, meshblock IDs and SA1 data.
View on CodePen
Multiple country address form
The code demonstrates the searching of an address from either AU or NZ. It then the populates the address info into the address fields. The country select box is used to determine which address database is searched.
View on CodePen
Autocomplete Address and Suburb-State-Postcode combination
Demonstrates configuring an autocomplete widget on the address field, as well as on the suburb field. This means that if a user is unable/unwilling to select their address for some reason, then they can still use the location autocomplete, ensuring they have a valid suburb/state/postcode combination.
View on CodePen
Custom styling: Fixed width adjustment
The example of the Addressfinder widget has the manual styling feature turned on. This enables the styling to be set by the customer rather than using the default style. When you make a search, you will notice the font and colour has been changed to match the style of the page.
View on CodePen
Smart Billing and Shipping Checkout Form
The example shows how Addressfinder can be used in a smart way within an address collecting form. By toggling the 'Ship to my billing address' button a user can specify a separate shipping address (no PO Box type addresses) to their billing address (address delivered to by Australia Post).
View on CodePen
Restriction by Geofence
The code produces a pop-up which notifies the user whether or not they are in the designated location. The location boundary is defined using a polygon.
View on CodePen
International Address Autocomplete
Demonstrates how to use the widget to search for addresses within 15 different countries.
View on CodePen
Multiple widgets on one page
The example shows how it's possible to use two widgets to collect two different types of addresses within the same page. We are using a billing and shipping address form as an example.
View on CodePen
Scrolling panel example
Displays the widget popup in a user-defined container, rather than at the bottom of the document body.
View on CodePen
Open Street Maps Address Geocoding with SA1
The example shows how you can capture Addressfinder data and populate it on Open Street Maps while also obtaining SA1 metadata. It functions for both AU and NZ.
View on CodePen
Geofence example with custom polygons
The example shows how you can use polygons to determine whether an address is in a particular area. In this example we use Australia's Mainland and Tasmania as the two "areas".
View on CodePen
Form without address line 2
The example shows the basic use case of the AddressFinder widget but on a form that has fewer address fields. This form only has one "address line" so the widget has been modified to combine the 'Address_Line_1' and 'Address_Line_2' elements when populating the content into the appropriate field.
View on CodePen