![]() In the HTML you’ll notice a element that contains all the standard address fields. If you’re unfamiliar working with Javascript and cannot get the Javascript working with your existing form then you should use the HTML, CSS and Javascript from the demo and tweak your form around that. googleCloudAPIKey: 'AIzaSyBVrqGDBqE85jvuaOO6-bXBTywbfCzoET0', Address fields In the Javascript you’ll need to edit line 10 and replace the API key in the example with your own. You’ll need to make a few edits to the Javascript options in order to get this script to work with your Google Account. Select Maps Javascript API and Places API.Under API restrictions select Restrict key.Enter the URL of the page you’ll use this script on.Under Application restrictions select HTTP referrers (websites).Lastly there are some optional but recommended steps: Create your Google Cloud Platform account (it’s free).Depending on how many lookups your users perform will depend how long that credit lasts for. When you signup Google give you a free $300 credit for your first year. This plugin is powered by Google Maps data and therefore you will need a free Google Cloud Platform account. If you’re unable to get this working with your existing form feel free to send me an email and I’ll help set it up for you. You can download the free address lookup script from GitHub or just copy the code from the tutorial below.Ĭode can be found on CodePen Setting up address-lookupįor this setup we assume that you’re able to edit the javascript file options and HTML to match your field setup. Start typing your own address and you’ll start to see suggestions. I’ve included a demo of how the address lookup works. Users don’t need to select their address from a list of houses on their street.Users are encouraged to type their address naturally – starting at the beginning – whereas postcode lookup asks for the last line first.You can search for international addresses. ![]() What is address lookup?Īddress lookup is better than post code lookup for a few reasons: ![]() But to even match the post code lookup cost each address would need to result in over 50 requests – which is unlikely. Note: With Google a single address lookup could consist of multiple requests.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |