wordpress 字段_如何在WordPress中使用动态字段填充自动填充表单

wordpress 字段

Do you want to use dynamic field population in WordPress to auto-fill forms on your website?

您是否要在WordPress中使用动态字段填充来自动填写网站上的表单?

Dynamic field population allows you to automatically fill form fields based on user selection, query strings, or field type.

动态字段填充使您可以根据用户选择,查询字符串或字段类型自动填写表单字段。

This makes your forms smart, saves users time, deliver a better user experience, and ultimately improves form completion rate.

这使您的表单更智能,节省用户时间,提供更好的用户体验,并最终提高了表单完成率。

In this article, we’ll show you how to use dynamic field population in WordPress to auto-fill forms.

在本文中,我们将向您展示如何在WordPress中使用动态字段填充来自动填写表单。

Automatically fill form fields in WordPress with Dynamic field population
什么是动态场人口? (What is Dynamic Field Population?)

Dynamic field population is a technique that allows website owners to automatically fill form fields based on user selection, form type, query strings, or conditional logic.

动态字段填充是一种技术,它允许网站所有者根据用户选择,表单类型,查询字符串或条件逻辑自动填充表单字段。

For example, an eCommerce store can create a form where product field in the form is dymanically populated using existing products in WooCommerce or any other eCommerce software.

例如,一个电子商务商店可以创建一个表单,其中使用WooCommerce或任何其他电子商务软件中的现有产品来动态填充表单中的产品字段。

Similarly, a real estate website can automatically populate listings, agents, property type fields in their appointment and lead generation forms.

同样,房地产网站可以自动在其约会和潜在客户生成表单中填充列表,代理,属性类型字段。

Advanced users and developers can also use URL parameters to dynamically fill out form fields using smart links from email newsletter or other website interactions.

高级用户和开发人员还可以使用URL参数通过电子邮件新闻稿或其他网站交互中的智能链接,动态填写表单字段。

Having said that, let’s take a look at how to easily use the dynamic field population in WordPress.

话虽如此,让我们看一下如何轻松地在WordPress中使用动态字段填充。

如何在WordPress中使用动态字段填充 (How to Use Dynamic Field Population in WordPress)

First, thing you need to do is install and activate the WPForms plugin. For more details, see our step by step guide on how to install a WordPress plugin.

首先,您需要做的是安装并激活WPForms插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

WPForms is the best WordPress contact form plugin on the market. It allows you to easily create online forms using a simple drag and drop tool.

WPForms是市场上最好的WordPress联系人表单插件 。 它使您可以使用简单的拖放工具轻松创建在线表单。

It also comes with dynamic field population, conditional logic, and advanced form fields. Together, these features allow you to create smarter and interactive forms for your website.

它还带有动态字段填充,条件逻辑和高级表单字段。 这些功能一起使您可以为网站创建更智能和交互式的表单。

Note: WPForms is co-founded by WPBeginner founder, Syed Balkhi.

注意: WPForms由WPBeginner创始人Syed Balkhi共同创立。

Upon activating the plugin, you need to visit the WPForms » Settings page to enter your license key. You can find this information under your account on the WPForms website.

激活插件后,您需要访问WPForms»设置页面以输入许可证密钥。 您可以在WPForms网站上的帐户下找到此信息。

WPForms License key

Next, you need to visit WPForms » Add New to create your first form. You’ll be asked to provide a name for your form and then select a template to start.

接下来,您需要访问WPForms»Add New创建您的第一个表单。 系统将要求您提供表单名称,然后选择一个模板来启动。

Creating a new form

WPForms will now load your form with pre-selected fields. You can click to edit form fields or use drag and drop feature to move them up and down. You can also add and remove form fields with just a click.

WPForms现在将使用预先选择的字段加载您的表单。 您可以单击以编辑表单字段,也可以使用拖放功能上下移动它们。 您还可以单击添加和删除表单字段。

Let’s add a new form field to populate it with dynamic choices.

让我们添加一个新的表单字段,以动态选择填充它。

You can add a dropdown, multiple-choice, or a checkbox field to your form to use dynamic choices options. Simply click on a field from the left column to add it to your form.

您可以在表单中添加下拉菜单,多项选择框或复选框字段,以使用动态选择选项。 只需单击左列中的字段即可将其添加到表单中。

Add form fields

Next, click to edit the field and then expand the Advanced Optins menu from the left column.

接下来,单击以编辑该字段,然后从左栏中展开“高级选项”菜单。

Advanced options

From here, you need to select a dynamic option under Dynamic Choices. WPForms supports post types and taxonomies registered on your WordPress site. For the sake of this tutorial, we’ll select Products post type.

在这里,您需要在“动态选择”下选择一个动态选项。 WPForms支持在您的WordPress网站上注册的帖子类型和分类法。 在本教程中,我们将选择“产品”帖子类型。

Dynamic choices

WPForms will now automatically load and display the fields in the form preview.

WPForms现在将自动加载并在表单预览中显示字段。

You can now save your form and exit the form builder.

现在,您可以保存表单并退出表单构建器。

To add the form in a WordPress post or page, simply edit the post or page where you want to add it.

要将表单添加到WordPress帖子或页面中,只需在要添加该帖子或页面的位置进行编辑。

On the post edit screen, add WPForms block to your post edit area. After that select the form you created earlier from the drop down menu.

在帖子编辑屏幕上,将WPForms块添加到您的帖子编辑区域。 之后,从下拉菜单中选择您之前创建的表单。

Adding WPForms block in WordPress

You can now save your post or page and visit your website to see your form with dynamic field values in action.

现在,您可以保存您的帖子或页面,并访问您的网站以查看具有动态字段值的表格。

WPForm preview
使用URL参数自动填写表单字段 (Automatically Fill Form Fields Using URL Parameters)

WPForms also allows you to dynamically fill form fields using URL parameters. This allows you to create smart links that automatically pass down information to the form and fill it for your users to submit.

WPForms还允许您使用URL参数动态填充表单字段。 这使您可以创建智能链接,这些链接会自动将信息传递给表单,并填写信息供用户提交。

First, you need to create a new form or edit an existing form in WPForms. Once you are done creating your form, switch to the settings tab from the left column and then select the ‘General’ tab.

首先,您需要创建一个新表单或编辑WPForms中的现有表单。 创建完表单后,请从左栏中切换到“设置”标签,然后选择“常规”标签。

On this screen, you need to check the box to Enable dynamic field population.

在此屏幕上,您需要选中启用动态字段填充框。

Enable dynamic fields

You can now save your form and exit the form builder. Your form is now ready to dynamically populate form fields using URL parameters.

现在,您可以保存表单并退出表单构建器。 现在,您的表单已准备就绪,可以使用URL参数动态填充表单字段。

Creating Links with URL Parameters

使用URL参数创建链接

WPForms accepts dynamic form fields passed through URL parameters in a specific format.

WPForms接受通过URL参数以特定格式传递的动态表单字段。

https://example.com/contact/?wpf15_1=value

https://example.com/contact/?wpf15_1=值

Let’s break it down.

让我们分解一下。

  • The part of the URL before the question mark ‘?’ is the URL of the page that has your form. For example, your contact form page.

    URL中问号“?”之前的部分 是具有您的表单的页面的URL。 例如,您的联系表单页面。
  • ?wpf – Indicates the start of the WPForm form field parameters.?wpf –指示WPForm表单字段参数的开始。
  • 15 – Is the ID of your form15 –是您表格的ID
  • _1 – Next you have the field ID_1 –接下来是字段ID
  • =value – = indicates the start of the value you want to pass to the form followed by the actual field value.= value – =表示要传递到表单的值的开头,后跟实际字段值。

Here is an example of a URL where we are passing a product title as a text field to a feedback form.

这是一个URL的示例,其中我们将产品标题作为文本字段传递给反馈表单。

https://example.com/contact/?wpf15_2=Vintage%20Flower%20Vase

https://example.com/contact/?wpf15_2=Vintage%20Flower%20Vase

Adding URL to your post

Notice, how we have used %20 to indicate spaces between words in the product title.

注意,我们如何使用%20来表示产品标题中单词之间的空格。

Finding Form and Field IDs in WPForms

在WPForms中查找表单和字段ID

In order to create URL parameters, you’ll need to know the form and field IDs. Here is how you can find these values.

为了创建URL参数,您需要知道表单和字段ID。 这是您如何找到这些值的方法。

Simply edit your form, and you will see the form ID in your browser’s address bar.

只需编辑您的表单,您将在浏览器的地址栏中看到表单ID。

Finding form ID in WPForms

Similarly, in order to find the form field ID, you need to just click to edit it. You will see form field properties in the left column along with field ID at the top.

同样,为了找到表单字段ID,您只需单击即可对其进行编辑。 您将在左列看到表单字段属性,在顶部看到字段ID。

Finding the form field ID

Now, what if you wanted to pass a value to a subfield?

现在,如果您想将值传递给子字段怎么办?

Simply add the subfield identifier after the field ID in your URL like this:

只需在URL中的字段ID之后添加子字段标识符,如下所示:

https://example.com/contact/?wpf15_3_city=london

https://example.com/contact/?wpf15_3_city=london

For more details, see WPForms developer documentation which shows more examples to use different parameters for all types of form fields.

有关更多详细信息,请参阅WPForms 开发人员文档 ,该文档显示了更多示例,以针对所有类型的表单字段使用不同的参数。

You can now use this feature in combination with your CRM software or email marketing service to send smart form links to your users. Most marketing platforms come with their own personalized MERGE tags that you can add in the smart URL to automatically fill personal information in the form.

现在,您可以将此功能与CRM软件电子邮件营销服务结合使用,以向用户发送智能表单链接。 大多数营销平台都带有自己的个性化MERGE标签,您可以在智能URL中添加这些标签以自动在表格中填写个人信息。

You can also use dynamic field population feature with other form plugins like Formidable Forms, Gravity Forms, etc. However, we recommend using WPForms because it makes the whole process easy, and we know it well because we built the product.

您还可以将动态字段填充功能与其他表单插件一起使用,例如Formidable FormsGravity Forms等。但是,我们建议使用WPForms,因为它使整个过程变得容易,并且因为我们构建了产品,所以我们对此非常了解。

We hope this article helped you learn how to use the dynamic field population in WordPress to auto-fill forms. You may also want to see our article on how to track and reduce form abandonment in WordPress.

我们希望本文能帮助您学习如何使用WordPress中的动态字段填充来自动填写表格。 您可能还想看一下我们有关如何跟踪和减少WordPress中的表单放弃的文章。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-use-dynamic-field-population-in-wordpress-to-auto-fill-forms/

wordpress 字段

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值