Gravity Forms 自动完成 (+address 字段)
此插件是 Gravity Forms 的附加组件,可启用自动完成字段功能。因此,它会为用户开始键入的字段建议可能的补全。自动完成简化并加快了表单填写过程,并通过查找带有建议的必要数据使您的用户节省时间。
请注意,您可以选择建议的来源。目前它支持多种来源类型: ‘WordPress’、’ URL’、’手动’ 和 ‘地址’。请免费填写以告知我们新的源代码类型,它将在下一个版本中添加。
请在此处查看插件演示: GF Auto Complete 演示
这个怎么运作?
例如,有一个名为 “Test” 的表单,您将向此表单添加一个自动完成字段。您只需将 autocomplete 字段放在表单上。
添加字段后,双击它以显示字段的设置。为“Where to Get Options?”设置选择“手动”,然后将显示新设置“输入数据以进行自动完成”。让我们把一些数据放进去,就像下面的截图一样。
请注意,有一个复选框“允许添加新选项”,勾选它以允许用户为前端的自动完成数据添加新选项。
要在表单设置中保存新字段,只需按“更新表单”按钮即可。之后,新字段将出现在前端。
请注意,新字段具有“无标题”标签,因为这是 Gravity Form 中的默认字段标签。可以在字段的设置中轻松更改它。此外,该表单应添加到一些 wordpress 页面,如上面的示例所示,否则它不会显示在您的网站上。
从哪里获得选项?
使用此设置可设置选项 (建议) 的来源。请注意,有几种类型的来源:“WordPress”、“URL (json)”和“手动”。下面将逐一描述。
- 这 “手动” 当需要手动设置选项时(如上面的示例所示),则使用 option 的调用。
- 这 ‘WordPress’ 选项用于使用不同的 WordPress 来源,例如:用户、页面、帖子、类别等。
- 这 ‘URL (json)’ 从 url 获取使用 AJAX 自动完成的选项,该 url 以 json 格式返回数据(如:value1、value2、value2 等)。
- 这 ‘地址’ 获取使用 Google Places Suggest API 进行自动完成的选项。
请查看设置中这些选项的屏幕截图。
如果您选择 “WordPress” 作为选项的来源,则文章标题将在建议列表中使用。 请注意:帖子 ID 保存在参赛数据中。如果您想保存另一个 post 属性(例如:post_title、post_name 等或保存自定义 post 字段),可以使用特殊的插件插件来完成。联系 我们的支持中心 购买该插件。
此外,请查看 JSON 文件的示例:
{“1” : “值1”, “2” : “值2”, “值2”, “3”: “值3”, “4” : “值4”, “5” : “值5”, “6” : “值6”, “7” : “值7”, “值7” : “值8” : “值8”}
默认情况下,建议列表包括值:“value1”、“value2”、“value3”等。
如果您想改用键(“1”、“2”、“3”等),请激活“使用 JSON 键作为字段值”选项
如何激活地址自动完成功能?
您需要将建议的来源设置为 ‘Address’。
在某些情况下,可能需要 google browser API 密钥。在这种情况下,请从以下网址获取 google browser API 密钥 http://console.developers.google.com/ 并将其添加到 设置
请确保在 Google 中启用以下 API:
检查前端的表单。您的地址字段应转到 Autocomplete(自动完成)。
方法 1:
方法 2:
非常感谢您评论此项目。如果您对此商品有任何疑问,我们很乐意为您提供帮助。如果你喜欢它,也要给插件评分
更改日志
Version 1.0.0 - 22 Dec 2016 ### Initial release Version 1.0.1 - 13 Jan 2017 ### New feature letting the user store the value that not in the autosuggest list. The function is applicable for a manually created autosuggest list. Version 1.0.3 - 07 Mar 2017 ### New feature letting the user to helping your users to enter their address with the Google Places suggest API. ### A lot of bugs fixed Version 1.0.6 - 07 July 2017 ### Fixed a multiple address fields bug ### Fixed a placeholder bug, updated an autocomplete javascript ### Fixed minor bugs with address autocomplete feature ### Moved the javascript to the footer Version 1.0.8 - 18 Aug 2017 ### Added ajax method for getting values for auto-complete field's suggestions. Now it's possible to use large data as an autocomplete field source. ### Fixed minor bugs Version 1.0.9 - 18 Dec 2017 ### Improved json file supporting. Now it's possible to use external url to JSON-file for suggestions ### Updated js autocomplete library. The plugin has been switched to select2 library ( https://select2.org ) ### Fixed minor bugs Version 1.1.4 - 30 Apr 2018 ### Added multi-value mode ### Fixed a bug occurring when several auto-complete address fields are placed on the same page of the form ### Switched to CDN versions of select2 libraries ### Added new routing field types "autocomplete" ### Fixed a bug occuring when user source type has been chosen for the autocomplete field ### Added a little rate limiting (250ms) between ajax calls; ### Added the search terms to the JSON request ### Fixed minor bugs Version 1.5.5 - 15 Dec 2018 ### Fixed bug with the placeholder option ### Fixed format for address autocomplete field; Now address number goes before the street name ### Fixed the conditional logic for auto-complete field ### Fixed the bug with the city field; it was not populated with appropriate value in address-autocomplete mode ### Fixed the bug with multiple values of autocomplete field; now entry contains all values and it's possible to edit them on Entry edit page. ### Fixed a bug related with WMPL compatibility ### Fixed a compatibility bug with Gravity View plugin ### Fixed minor bugs Version 1.5.9 - 5 Apr 2019 ### Fixed the bug with gform_field_value filter ### Fixed a bug with l35 js array ### Fixed a bug with required state for address autocomplete field ### Fixed the compatibility bug with new GF version 2.4 ### Fixed minor bugs Version 1.6.1 - 20 Jul 2019 ### Added an ability to add a new option for auto-complete sources types and fixed a bug with js ### Fixed a bug with nested forms ### Fixed a bug with the dropdown parent select2 option ### Added the autocomplete field messages to a language file ### Improved and optimized the plugin code ### Fixed minor bugs Version 1.6.5 - 11 Jan 2020 ### Improved a function looking for matches in suggestions for the autocomplete field with the JSON data source. ### Added an ability to use a JSON key as a value for an autocomplete field when JSON is set as the autocomplete source. ### Fixed BOM symbol bug in some plugin files ### Added a feature to test the connection to given JSON URL right in edit autocomplete field interface. ### Fixed minor bugs Version 1.6.8 - 19 Mar 2020 ### Fix json bug ### Fix the bug occurring when several autocomplete fields with the same data source are added on the same page ### Fix minor bugs Version 1.7.2 - 04 July 2020 ### Added a new two inputs (address name, address street number) for the address autocomplete mode; both input values are available in the entry data ### Added the field_use_first_char option for JSON source type. It changes the comparing method in searching for user input through JSON suggestions list. ### Added some hooks in the plugin code: - gfautocomplete_field_input_value_html - gfautocomplete_inline_js_on_page_render - gfautocomplete_load_fields_settings - gfautocomplete_add_custom_settings ### Fixed a bug with autocomplete field width ### Fixed minor bugs Version 1.7.3 - 19 July 2020 ### Fixed a bug in javascript code (comma-js-bug) ### Fixed a bug with manual autocomplete field ### Added an ability to make a search in JSON keys instead of values ### Added a new hook in the plugin code: - gfautocomplete_address_parts_after Version 1.7.6 - 21 Sept 2020 ### Fixed a bug when entry value is not saved ### Added the German translation ### Added the field_min_input_len option to the field settings Version 1.8.2 - 21 Jan 2021 ### Updated JavaScript select2 library to the newest version ### Code refactoring and integration with new select2 library ### Fixed issues with placeholder ### Fixed minor bugs Version 1.8.3 - 29 May 2021 ### Fixed a rare bug occurring with the curl module Version 1.8.4 - 6 June 2021 ### Fixed bug: re-init google map script for the address autocomplete field if it's loaded in a form using shortcode with ajax parameter Version 1.8.6 - 20 December 2021 ### Added new option to set the maximum number of items which can be selected in a multi-value mode. If the value of this option is less than 1, the number of selected items will not be limited. ### Refactor of the field settings page ### Updated select2 library to the latest version. Old version of the library caused the conflicts with Elementor. Version 1.8.8 - 18 March 2022 ### Fixed quotes handling in the manual data source ### Fixed bug: Now if you enable "Allow adding new option" and choose WordPress as autocomplete data source, a new post is created on form submission