🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!
Guides & Tutorials October 22, 2026

How to Add Address Autocomplete to Gravity Forms With Mapbox, Geoapify or LocationIQ

GravityExtra
How to Add Address Autocomplete to Gravity Forms With Mapbox, Geoapify or LocationIQ

Typing an address is the part of a form that people dislike the most. It is long, it has an awkward order, and one wrong digit in a postcode sends a parcel to the wrong place. An address autocomplete fixes all three: the visitor types the first letters, picks the right line from a list, and the street, city, state, postcode and country fill in by themselves. Most guides on the subject start with a Google key. This one does not. It shows how to add address autocomplete to Gravity Forms with Mapbox, Geoapify or LocationIQ, how to keep the bill small, and how to keep the key private.

Why look beyond the usual choice

Google Places is a fine service, but it is not the only one, and it is not always the right one. Some sites cannot or will not create a Google Cloud account with a billing method. Some want a provider whose terms allow them to store the coordinates they get. Some serve visitors in a region where another map is better, or want results in the local language without extra work. And some simply want a free plan to start with. Mapbox, Geoapify and LocationIQ all have a self-service sign-up and a free plan, and they all answer with the same things a form needs: the street, the house number, the city, the state, the postcode, the country and the coordinates.

The Gravity Forms Mapbox and Geoapify Address Autocomplete Premium Add-on connects those three to Gravity Forms. You pick one, paste its key, and switch the autocomplete on for any Address field or Single Line Text field. The rest of this article follows the steps and the choices you will face on the way.

Step 1: choose a provider and get a key

  • Geoapify is the easiest to start with. One API key, an allowed-origins list, results with the house number and state code, and map tiles from the same account.
  • Mapbox has the most polished search. Its Search Box service works in two calls: suggestions while the visitor types, and one call for the details of the chosen address. Both calls share a session token, and Mapbox bills the session once.
  • LocationIQ is built on open map data, has a simple token, and normalises the city and state for you.

For each of them you create the key in the provider’s dashboard and restrict it to your site address there. A restricted public key is safe to use in a page, because it only works from your domain. If you cannot restrict a key, or you hold a secret token, the add-on has a second way, described in step 5.

Step 2: switch it on for an Address field

Open the form, click the Address field, and open the Advanced tab. Tick Suggest addresses while typing. That is the whole setup for a standard form. Visitors who type in the street line now see a list, and a click fills every part of the address.

The address autocomplete settings of one field in the Gravity Forms form editor: switch on, countries, what to suggest, latitude and longitude fields and the map
The settings of one field in the form editor.

The country and state are matched against the lists that Gravity Forms shows, ignoring accents and capital letters, so Cote d’Ivoire finds Côte d’Ivoire and a US state drop down gets Colorado. When a value is not in the list, the add-on leaves the drop down alone instead of choosing something close.

A Gravity Forms address field with the first letters of a street typed and a list of two street suggestions with the city, postcode and country under each
Suggestions appear while the visitor types, with the city, postcode and country under each street.

Step 3: narrow the search

The best way to improve the suggestions is to tell the provider where your visitors live. Enter the countries in the add-on settings, or per field: us,ca for a shop that ships to North America, de,at,ch for a German-speaking service. Results from other countries then never appear, which also means a shorter list and fewer mistakes. You can also choose what to suggest: full street addresses, only postcodes, or only cities. A "Your city" field set to cities returns Regensburg and nothing else.

Two more options help. The language of the suggestions follows the language of your site unless you set another one. And Favour places near the visitor lets the provider rank nearby results first, using the visitor’s IP address or, if the visitor agrees, the position of the browser. It is only a preference: results from elsewhere still show if you ask for them by name.

Step 4: keep the bill small

Autocomplete services bill by the request, and a naive script sends one for every key stroke. The add-on does five things to avoid that.

  1. It waits for a pause in typing (300 milliseconds by default) before it asks.
  2. It does not ask before the third character.
  3. It cancels an older request when a newer one starts, so the answers cannot arrive in the wrong order.
  4. With Mapbox Search Box it uses one session token for the whole conversation: all the suggestion requests and the final request share it, and a new token starts after each choice. Mapbox counts that as a single session.
  5. With Geoapify and LocationIQ, a text that was already searched on the page is answered from memory.

Filling in the street after a choice does not start a new search either; that is a common bug in simple scripts, where the filled in text looks like new typing and opens the list again. If you want the lowest bill, raise the wait to 500 milliseconds and the minimum to four characters.

Step 5: hide the key

A restricted key in a page is acceptable, but some teams do not want any key in a page. Switch on Hide the key and the browser stops talking to the provider. It asks your own site, and your server adds the key and asks the provider. The page then holds no key at all, and a Mapbox secret token can be used safely.

A proxy that anyone can call is an open door, so this one is strict. It answers only for forms and fields that have the autocomplete switched on, only for the endpoints of the provider you chose, and only with parameters that pass a check. A key or a format sent by a visitor is ignored. Every visitor is limited to 60 requests per minute by default, counted by IP address. Over the limit the site answers with a 429 and a Retry-After header, and the provider is not called at all. If the provider has a problem, the visitor sees a short message and can type the address by hand.

Step 6: save the coordinates, show a map

Choose a hidden field for the latitude and another for the longitude, and every choice is saved with the entry. That gives you what you need for delivery zones, distance to a branch or a map of your customers. If you use Mapbox Geocoding v6 and store coordinates, switch on its permanent results, as its terms ask.

For forms where the exact spot matters, tick Show a map with a draggable pin. A map appears under the field after the visitor chooses an address. The pin can be dragged, the map can be clicked, and the pin can be moved with the arrow keys. Each move saves new coordinates and looks the address up again, so the street fields follow the pin. This suits a delivery point at a large site, a pick-up place, a service call at a farm, or a rental where the building has no number. The map is drawn with MapLibre GL, which is shipped inside the add-on, and the tiles come from the provider you chose, with its attribution.

A Gravity Forms address field filled in, with a map under it that shows a draggable pin at the chosen address and the map attribution
The optional map shows a pin that the visitor can drag; the address is looked up again.

Accessibility is part of the job

A list that appears under a field must work without a mouse. The input is a combobox in the sense of the ARIA standard, the list is a listbox and each suggestion is an option. The Down and Up arrows move through the choices, Enter takes one, Escape closes the list without changing the text, and Tab simply moves on. A live region reads out how many suggestions there are and which address was filled in. The pin of the map can be reached with the Tab key and moved with the arrows. Right-to-left pages work too, with the list lined up to the field.

Where to use it

  • Online shops: shipping and billing addresses without typing mistakes, and fewer returned parcels.
  • Quote and booking forms: the service address, with the coordinates saved for routing.
  • Membership and event forms: one clean address that matches your mailing list.
  • Franchise and store finders: the city or postcode field as a single suggested line.
  • Field service and delivery: the pin on a map for places without a number.

What it does not do

It suggests and fills addresses. It does not check that the address exists at the post office; for that you want an address verification service. It does not change the way the entry is stored, and it does not need any change to your existing forms: switch it on per field, and switch it off the same way.

Frequently asked questions

Is a free plan enough?

For a small site, yes. Each provider has a free plan with a monthly allowance. The wait after typing and the session token of Mapbox keep a normal form well inside it. Check the current limits at the provider.

Can visitors from other countries still type their address?

Yes. The list is a help, not a rule. A visitor can ignore it and type, and the form accepts what they typed.

Does it work with Gravity Forms Ajax forms and multi page forms?

Yes, the fields start again each time the form is drawn.

Do I need to change my forms?

No. You switch it on per field in the form editor.

Which Gravity Forms versions does it support?

Gravity Forms 2.9 and newer. It is tested with Gravity Forms 3.1.2 on PHP 8.3 and Gravity Forms 2.9.8 on PHP 7.4.

Is there a Google version?

Yes, as a separate add-on. If you already have a Google key and want to use it, the Google Address Autocomplete add-on is the right one. This one is for the other providers.

Get started

The Gravity Forms Mapbox and Geoapify Address Autocomplete Premium Add-on gives you address suggestions from Mapbox, Geoapify or LocationIQ, coordinates, a draggable map pin and a server-side proxy for the key. See the features, the price and the setup guide on the add-on page.

See the Address Autocomplete add-on

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr