Linux 软件免费装
Banner图

Logicoo Form Address & Autocomplete

开发者 logicoo
更新时间 2026年11月4日 04:48
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

google maps address autocomplete places address field logicoo-form

下载

1.0.1

详情介绍:

Free add-on for the Logicoo Form plugin. It adds an Address field to the form builder. When you turn on the service with your own Google Maps Platform API key, visitors can get address suggestions from Google Maps while they type, and choose their address from a list. Requires Logicoo Form 1.2.0 or later. With an older Logicoo Form the add-on does not start, and forms with an Address field show a notice and cannot be sent until Logicoo Form is updated. With Logicoo Form 1.3.0 or later, the Address field also works inside repeatable groups. Before you use it

安装:

  1. Install and activate Logicoo Form 1.2.0 or later.
  2. Install and activate this add-on.
  3. In the Google Cloud console, create an API key. Enable the Maps JavaScript API and the Places API (New); enable the Geocoding API only if you will use the "Use my location" button, and the Address Validation API only if a field will use the postal check. Restrict the key to these APIs and to your website, and set daily quotas: a budget only sends alerts.
  4. Go to Logicoo Form > Address Autocomplete, enter the key, turn on the service and click "Test the key".
  5. In the form builder, add an Address field to a form.
  6. Optional, for fields with "Google addresses only": create a second API key, restricted to the Places API (New) and, if your hosting has a fixed IP address, to that address (IPv4 and, if the server has one, IPv6), with daily quotas. Enter it as the server key and test it.

屏幕截图:

  • The chosen address also fills in the postcode, city and country fields of the form.
  • Settings page: service, Google API keys, privacy, costs and limits, texts, key test and diagnostics.

常见问题:

Is my Google API key safe?

A browser key is public by nature: every site that uses Google Maps sends it to the browser. The add-on never writes it in the page: the visitor's browser receives it only after the visitor turns on the suggestions. What protects the key is the restriction to your website and to the APIs you use, set in the Google Cloud console. Once a day the add-on checks that Google refuses the key from your server, and warns you if the key works from any website (or stops the service, if you choose so). You can also define the key in wp-config.php with the constant LFADDR_GOOGLE_API_KEY, so that it stays out of database backups.

How much does it cost?

Google bills your Google Cloud account for the requests sent by the visitors' browsers, with a free monthly usage for each item of its price list. The add-on estimates these requests on your site, shows the estimated cost of the month, and can email the administrator at the thresholds you set or stop the service at a monthly limit (Logicoo Form > Address Autocomplete > Costs and limits). They are estimates: the Google Cloud console is authoritative. The limit per page view protects against errors, not against attacks: set daily quotas in the Google Cloud console too.

Do visitors have to turn on the suggestions on every page?

Without a cookie plugin, yes: the button turns on the suggestions for the current page only, and nothing is saved in the browser. With a cookie plugin that supports the WP Consent API in opt-in mode (for example Complianz), a visitor who accepts the category chosen in the add-on settings (Marketing by default) gets the suggestions without the button, on every page. If the visitor later refuses that category, the button comes back. The Functional category is never used, because cookie plugins usually grant it without asking.

My cookie plugin uses opt-out. Which setting should I choose?

By default the add-on shows the button even when a cookie plugin in opt-out mode presumes a yes. With "Follow the answer of the cookie plugin" (Logicoo Form > Address Autocomplete > Privacy), the suggestions start at the first key the visitor types, unless the visitor has refused the category; a refusal brings the button back. This choice is meant for visitors from countries where cookie plugins use opt-out, such as the United States. Do not use it for visitors in Europe: keep your cookie plugin in opt-in mode for them. Do not use it on health-related sites with visitors from Washington State. Global Privacy Control always wins.

My site sends a Content Security Policy. What must it allow?

The Google Maps JavaScript API needs the sources listed in Google's guide: https://developers.google.com/maps/documentation/javascript/content-security-policy. Among them: maps.googleapis.com, maps.gstatic.com and places.googleapis.com. The add-on itself adds no inline styles: its stylesheet is a file, and the suggestion list is placed with style properties set by its script, which a style-src without 'unsafe-inline' allows. Like most plugins, it prints its browser settings as a small inline script (wp_localize_script): a policy based on nonces must cover the inline scripts of WordPress.

The form is inside an iframe. Does the "Use my location" button work?

Browsers block the location in an iframe unless the iframe allows it. Add allow="geolocation" to the iframe tag, for example: <iframe src="https://example.com/contact/" allow="geolocation"></iframe>. Without it, the button shows a message that location access is blocked, and the visitor can still type the address or use the suggestions.

When should I use "Google addresses only"?

For shipping addresses, when a wrong or incomplete address costs you a lost parcel. The field accepts only an address chosen from the suggestions: with the address check "With a street number", a street without a number is not enough, and the field asks the visitor to add it. Every response then needs at least one search on Google, so the cost grows with the responses. The mode guarantees that the text is an address suggested by Google. It does not guarantee that the address exists or that it is the visitor's: Google can miss an address, or know it badly. The other fields filled from the address stay editable: if the visitor changes one after the choice, a warning appears next to it, and the form can still be sent. For the flat, floor or "care of", add a separate Text field: the chosen text cannot be completed by hand.

What happens to visitors who do not turn on the suggestions, or have no JavaScript?

In this mode the suggestions are needed to complete the field: a visitor who does not turn them on cannot send the form. Write an alternative contact in the field description, such as a phone number or an email address. Without JavaScript, the property "without JavaScript, or a text that is not the Google address" decides: accept the text, marked as "Not checked: without JavaScript" (the default, so you do not lose the order), or reject the submission. A note under the field tells visitors without JavaScript what to do. When Google does not respond, or a request limit is reached, the property "if Google does not respond" decides in the same way. With "Block the submission", reaching the monthly limit of the request counter stops the orders too.

The street number has a letter, or the visitor cannot find the address.

Google often drops the letter of a street number: "12/A" becomes "12". After the choice, the visitor can add a short suffix right after the number, such as "12A", "12/A" or "2 bis", unless the property "letter after the street number" does not allow it. Some squares and places are missing from the address suggestions: "I can't find my address", under the suggestions, searches again without the filter on the type of results. If the address is still missing, the property "if the visitor cannot find the address" decides: accept the address as typed, marked as not checked (the default), or block the submission and invite the visitor to contact you. In that case, write a contact in the field description.

How do I use the result of the address check?

Each response of a field with "Google addresses only" has an "Address check" row next to the address, in Responses, emails, PDF, CSV and the personal data export. It says how the address was checked, for example "Chosen from the suggestions (checked by the server)", "Chosen from the suggestions (declared by the browser)", "Verified by Google (declared by the browser)", "Confirmed by the visitor after a warning (declared by the browser)" or "Not checked: Google not available". Before shipping, look at the responses marked "Not checked", and remember that a result declared by the browser can be faked by whoever sends the form. The saved address comes from Google Maps: see "Before you use it".

What does the postal check do?

It is the third level of the address check of a "Google addresses only" field, off by default. After the visitor chooses an address, Google checks that it is complete and deliverable: the key needs the Address Validation API. If Google confirms it, the field is valid. If Google corrects or completes it, for example the postcode, the visitor sees the corrected address with "Use this address" and "Change address": nothing changes without the visitor's choice. If Google does not confirm a part, such as the street number, the visitor can correct the address or answer "It is correct, use this address". Google cannot confirm some real street numbers: the visitor's answer keeps the order. The question appears next to the field, never in a window, and works with the keyboard and screen readers. Of the 17 countries we tested, Google checks all but San Marino; where Google does not check addresses, the field works as with "With a street number". If the check is not available, the property "if Google does not respond" decides. The response saves "Verified by Google" or "Confirmed by the visitor after a warning", always declared by the browser. Each check is one Address Validation Pro request, never repeated for the same address on the same page: 5,000 free per month, then USD 17 per 1,000 (Google's price list of 2026-10-07).

What does the server key do?

Without it, the result of the address check comes from the visitor's browser, and it is marked "declared by the browser". With a server key, when a form is sent the server asks Google for the parts of the chosen address and compares them with the text it receives: a match is marked "checked by the server", a different text follows the rule "without JavaScript, or a text that is not the Google address". This costs one Place Details Essentials request for every response, counted by the request counter. If Google does not answer within three seconds, the response is accepted with the browser's result; all the checks of one response wait eight seconds at most. Use a key different from the browser key, restricted to the Places API (New) and, if your hosting has a fixed IP address, to that address: add the IPv4 address and, if the server has one, the IPv6 address too, because the server may call Google with either. If Google refuses the server key from your server, the key test says so. You can define it in wp-config.php with the constant LFADDR_GOOGLE_SERVER_KEY. The last check is shown in the diagnostics, without the address.

Does the Address field work inside a repeatable group?

Yes, with Logicoo Form 1.3.0 or later. Every item of the group has its own Address field, with the suggestions, the "Use my location" button, "Google addresses only" and the postal check, and the form response saves the result of the check for each item. Inside a group the field does not fill other fields, because Logicoo Form lets you choose only fields outside the group, and every item would overwrite them. "Duplicate" copies the chosen address with its check, without new requests to Google. Every item counts towards the limit per page view: for groups with many items, raise the limit in the settings.

What happens to my forms if I deactivate the add-on?

Logicoo Form keeps the Address fields, with their properties, and the addresses already saved in the form responses. A form with a visible Address field cannot be sent: if the field has no conditions, Logicoo Form shows a notice instead of the whole form; if a condition shows the field, the notice takes the place of the field. The Logicoo Form screens list the published forms involved, and the builder shows a notice on the field. When you activate the add-on again, the fields work as before.

My site is behind a proxy or a CDN.

Against abuse, the add-on limits the requests of each visitor with a non-reversible fingerprint of the IP address. It reads the IP address from the server (REMOTE_ADDR) and from the logicoo_form_client_ip filter of Logicoo Form. The "Trusted proxies" setting of Logicoo Form is not available to add-ons: if your site relies only on it, the add-on sees the address of the proxy, and all visitors share the same limit. Use the logicoo_form_client_ip filter, or have the web server put the visitor's IP address in REMOTE_ADDR, trusting only the addresses of your proxy or CDN: for example with the realip module of nginx or the mod_remoteip module of Apache. Many hosting providers and CDNs document this setting.

Why is the add-on in English on my site?

Translations come from translate.wordpress.org, like those of Logicoo Form. Until the translation into your language is approved there, the add-on is in English, including the notice that visitors see under the field. You can rewrite the texts for visitors (the notice under the field and the location confirmation) in Logicoo Form > Address Autocomplete > Texts.

更新日志:

1.0.1 1.0.0