Do you want to learn how to make a Google Maps autocomplete address form?
Adding an autocomplete address field to your website forms improves user experience, saves time, and validates the submitted address by using the power of Google Maps.
So in this tutorial, we’ll walk you through a step-by-step guide on how to make a Google Maps autocomplete address form – without juggling with any custom HTML code!
Here’s a table of contents if you’d like to jump ahead:
- Install the WPForms Plugin
- Enable the Geolocation Addon
- Configure Geolocation Settings
- Create a Google Maps Autocomplete Address Form
- Add Address Field to Your Form
- Enable the Address Autocomplete Feature
- Add Your Google Maps Autocomplete Address Form to Your WordPress Website
How Do I Make a Google Maps Autocomplete Address Form?
Wondering how to use the Google Maps address autocomplete feature? Address autocomplete is one of the powerful features in Google Maps. You can add autocomplete to your WordPress contact forms to make them easier to fill in.
Embedding Google Maps address autocomplete feature into a contact form requires prior coding knowledge. But if you use a form builder plugin like WPForms, you can do the process in a few steps and without coding.
WPForms Pro includes a powerful Geolocation addon that comes with a pre-built address autocomplete feature. This feature auto-locates and automatically suggests your users’ locations as they fill out and type in their addresses.
Furthermore, with the Geolocation addon, you can add a map to your WordPress contact form and allow your users to add a location by adjusting the pin on the map.
Let’s see how to create a Google Maps autocomplete address form with WPForms and the Geolocation addon.
Step 1: Install the WPForms Plugin
The first thing you’ll need to do is to install the WPForms plugin. Once WPForms is installed, click on the activate button.
If you’re new to WordPress or facing any difficulty during the plugin installation process, you can check the step-by-step guide on how to install a WordPress plugin.
Step 2: Enable the Geolocation Addon
Once WPForms is installed, you’ll be able to turn on the Geolocation addon.
Now to activate the addon, head over to your WordPress dashboard and click on WPForms » Addons.
In the search bar, type Geolocation and press it on to Activate.
Step 3: Configure Geolocation Settings
Once you’ve enabled the Geolocation addon, you need to configure its settings. To do this, click on WPForms » Settings.
On the WPForms settings page, click Geolocation from the tabs across the top.
Here you’ll see different options to configure the Geolocation addon:
- Places Provider: You get the option to choose which provider you’d like to receive your geolocation information. Here we’ll select the Google Places API as our places provider.
- Current Location: Enable this option to allow your user’s location to be pre-filled into the form.
- Google Places API: To enable autocomplete address feature and display Google Maps within your forms, you’ll need to generate an API Key and connect it with WPForms.
Let’s see the complete process of generating an API key.
Generate an API Key From Google Developer Console
Go to the Google Developer Console and select the project from the Select a Project menu at the top. If you don’t have any previously created projects, click New Project to create a new one.
Once you’ve successfully created a new project, click Enable APIs and Services.
This will open a Google API Library.
From here, you’ll need to enable three 3 APIs:
- Geocoding API
- Places API
This API library provides an easy search option; type the name of the API in the search box, go to your API and click the ENABLE button.
Once you’ve enabled all your APIs, go back to your Google Console dashboard and navigate the Credentials tab.
Click on the Create Credentials button at the top and select the API key option.
A pop-up with an API key will open. Click on the RESTRICT KEY option at the bottom right corner of the pop-up.
A new page will open, where you’ve to configure the following settings:
- Application Restrictions: From here, you can select which websites, IP addresses, or applications you can use the API key. Here you’ll need to choose the HTTP Referrers option to allow your Key to be used within your websites.
- Website Restrictions: Once you select the HTTP Referrers, a new option will be displayed, website restrictions. Here you need to add your website domain name to restrict the API Key to be used only by the specified websites.
- API Restrictions: After restricting your Key by Application and Website, you’ll need to restrict your Key by API. To do this, click the Restrict key option.
This will open a dropdown with a multiple APIs option. Select the following APIs from the dropdown:
- Places API
- Geocoding AP
Once you’re done with selecting the APIs, click the Save button to save your settings.
Clicking the save button will redirect back you to the Credentials page. Copy your Key from the page and head back over to your WPForms settings.
In your WPForms settings, paste this into the API Key field under the Google Places API and click on the Save Settings button.
Great! Let’s now go ahead and add autocomplete address feature to your forms.
Step 4: Create a Google Maps Autocomplete Address Form
Now that we’re done with the API settings, it’s time to create a Google Maps autocomplete address form.
For that, first, we need to create a new form using WPForms. Go to WPForms » Add New to create a new form.
On the setup screen, add a name to your form and select the template you want to use. WPForms includes a huge pre-built template library that consists of 300+ beautiful form templates.
You can choose any template and use it on your website.
Here we’ll choose a Simple Contact Form template. Click on the template to view it live on the form builder dashboard.
Below you can check the WPForms form builder dashboard. From this builder, you can add additional fields to your contact form.
Step 5: Add Address Field to Your Form
Now that we have our form ready, we just need to add the Address Field.
On the left, from the Fancy Fields section, drag the Address Field and place it onto your form.
The Address field already includes a label and sub-label text for your ease. You get the flexibility to:
- Customize the label text
- Select scheme format for the address field
- Customize field size
- Hide label
- Hide sub-labels
Step 6: Enable the Address Autocomplete Feature
To enable the Address Autocomplete Feature, go to the Advanced tab of the Address field.
Scroll down till you see a checkbox with Enable Address Autocomplete option.
Check the box to enable the Address Autocomplete in your form. Allowing this will open one more feature: Display Map. If you want to display a map with your contact, check this option too.
Click on the Save button at the top to get everything settled.
Step 7: Add Your Google Maps Autocomplete Address Form to Your WordPress Website
Now that your autocomplete address form is ready, it’s time to add it to your website.
WPForms allows you to add your form in multiple locations, including pages, blog posts, and even sidebar widgets of your website.
Before embedding your form to a page, if you want, you can check how your form will look on the live page. To preview your form, click on the Preview button at the top.
Let’s add your Google Maps autocomplete address form to your page.
Create a new page or open an existing page on the WordPress website. Click on the “+” icon and add the WPForms block from the block editor.
Select your form and publish the page.
Awesome job! You’ve successfully created a Google Maps autocomplete address form.
Next, Track Your WordPress Form Conversions
And there you’ve it! With WPForms Geolocation addon, you can easily enable the autocomplete address feature on your website contact forms and enhance your visitor’s experience.
After creating a Google Maps autocomplete address form, you might be interested in tracking the sources that are bringing traffic and prospects to your website. To learn more, check out our detailed tutorial on how to track a lead source in WordPress.
Next, you might be interested in checking the simple tricks to eliminate spam user registration.
So, what are you waiting for? Get started with the most powerful WordPress forms plugin today.