How to Enable Prefill By URL Setting in WPForms

Introduction

Would you like to enable and use the Enable Prefill By URL setting on your WPForms? Using this setting, you can autofill form fields for a user by including values in the URL.

What is Enable Prefill By URL?

You can use this setting to populate some of your form fields from one form to another by pulling out information in the URL.

You can find a good example of that here in this article.

Enabling the Prefill By URL

To enable this option within a form, you’ll need to first open the form builder and go to Settings » General from within the form builder and click the Advanced tab. Toggle the option labeled Enable Prefill By URL to enable this.

Enable Prefill By URL setting on the General tab of the settings of the form inside the Advanced options

Assembling the URL

Next, you’ll need to assemble a URL with a query string. The query string will use GET parameters to target a specific field and include the value for that field.

But it doesn’t matter what the field type is.  All query strings for the Enable Prefill By URL setting will follow the same general structure. As an example, here’s a URL with the basic query string structure you’d need:

http://test.com?wpf20_1_subfield=value

  • ?wpf: Indicates the start of a query string for WPForms prefill by URL setting.
  • Form ID: Targets a specific form (in the above URL, the Form ID is 20).
  • Field ID: Targets a specific field within the form (in the above URL, the Field ID is 1).
  • Subfield Identifier (Optional): Used only when targeting a subfield, such as the City subfield within an Address field (in the above URL, this is simply named “subfield”).
  • = (Equals Sign): Indicates the start of the value.
  • Value: The value you want to add/select for a field. Any spaces should be replaced with %20.

Next, we’ll take a look at some more specific examples and the query string formats you’ll need for various field types.

Populate Multiple Fields in the Same Form

If you’d like to populate more than one field with a single query string, you can include multiple parameters within your query string. For example:

?wpf111_1=text&wpf111_2=othertext

Populate Fields in Different Forms on the Same Page

If you were to have more than one form on the same page, you can combine parameters within a single query string. Such as this example:

?wpf111_1=text&wpf222_1=othertext

Using Conditional Logic with this setting

When using conditional logic, this will continue to work as expected even when using the prefill setting. What this means is that any conditional fields will hide/display based on any fields that have been auto-filled (conditional logic is applied after fields have been dynamically populated).

Query String Formats for Specific Fields

The table below shares more details and examples on how to set up GET parameters for each field type. If a field has different formatting options, specific examples for those are included as well.

Single Line Text
Field Format / Variations GET parameters
?wpf771_1=text%20of%20any%20length
Paragraph
Field Format / Variations GET parameters
?wpf771_2=text%20of%20any%20length
Field Format / Variations GET parameters
?wpf771_3=Second%20Choice
Show Values enabled ?wpf771_4=dropdown1
Dynamic Choices: Post Type ?wpf771_5=123
(123 is the Post Type ID)
Dynamic Choices: Taxonomy ?wpf771_6=12
(12 is the Taxonomy ID)
Multiple Choice
Field Format / Variations GET parameters
?wpf771_7=Second%20Choice
Show Values enabled ?wpf771_8=choice2
Image choice ?wpf771_9=Second%20Choice
?wpf771_9=choice2
(Depends on Show Values option)
Dynamic Choices: Post Type ?wpf771_10=123
(123 is the Post Type ID)
Dynamic Choices: Taxonomy ?wpf771_11=12
(12 is the Taxonomy ID)
Checkboxes
Field Format / Variations GET parameters
?wpf771_12=Second%20Choice
?wpf771_12[]=Second%20Choice
?wpf771_12[]=Second%20Choice&wpf771_12[]=Third%20Choice
Show Values enabled ?wpf771_13=checkbox2
Image choice ?wpf771_14=Second%20Choice
?wpf771_14=checkbox2
?wpf771_14[]=Second%20Choice&wpf771_14[]=Third%20Choice
(Depends on Show Values option)
Dynamic Choices: Post Type ?wpf771_15=123
?wpf771_15[]=124
(123 is the Post Type ID)
Dynamic Choices: Taxonomy ?wpf771_16=12
?wpf771_16[]=13
(12 is the Taxonomy ID)
Numbers
Field Format / Variations GET parameters
?wpf771_17=2018
Name
Field Format / Variations GET parameters
Simple ?wpf771_18=name
First Last ?wpf771_18_first=first%20name&wpf771_18_last=last%20name
First Middle Last ?wpf771_19_first=first%20name&wpf771_19_last=last%20name&wpf771_19_middle=middle%20name
Email
Field Format / Variations GET parameters
[email protected]
Confirmation enabled [email protected]
GDPR Agreement
Field Format / Variations GET parameters
Not supported.
User should manually click the checkbox to agree.
Website / URL
Field Format / Variations GET parameters
?wpf771_23=https://google.com
Some servers may block requests that include a URL as a parameter. Be sure to test!
Address
Field Format / Variations GET parameters
US ?wpf771_24_address1=Address%20Line%201&wpf771_24_address2=Address%20Line%202&wpf771_24_city=Del%20Mar&wpf771_24_state=CA&wpf771_24_postal=12345
International ?wpf771_25_address1=Address%20Line%201&wpf771_25_address2=Address%20Line%202&wpf771_25_city=Kharkiv&wpf771_25_state=Kharkiv Oblast&wpf771_25_postal=61000&wpf771_25_country=Ukraine
Password
Field Format / Variations GET parameters
Not supported.
User should enter value(s) manually.
Phone
Field Format / Variations GET parameters
US/International ?wpf771_27=5555551234
Date / Time
Field Format / Variations GET parameters
Format: Date, Type: Date Picker ?wpf771_28_date=11/22/2018
Date, Type: Date Dropdown (subfield) ?wpf771_29_date_m=11&wpf771_29_date_d=22&wpf771_29_date_y=2018
Time, Format: 12 H (subfield) ?wpf771_30_time=6:00am
Time, Format: 12 H (subfield) ?wpf771_31_time=13:00
Format: date-time ?wpf771_32_date=11/22/2018&wpf771_32_time=13:15
?wpf771_32_date_m=11&wpf771_32_date_d=22&wpf771_32_date_y=2018&wpf771_32_time=6:30am
Hidden
Field Format / Variations GET parameters
?wpf771_33=hidden%20value
HTML
Field Format / Variations GET parameters
Not supported.
This field is not user-editable.
File Upload
Field Format / Variations GET parameters
Not supported.
Security measures.
Page Break
Field Format / Variations GET parameters
Not supported.
This field is not user-editable.
Section Divider
Field Format / Variations GET parameters
Not supported.
This field is not user-editable.
Rating
Field Format / Variations GET parameters
?wpf771_38=4
Will highlight 4/5 or 4/10, depending on the rating scale is.  An example being 4/3.
Captcha
Field Format / Variations GET parameters
Not supported.
User should manually complete the captcha (Math or Question and Answer).
Signature
Field Format / Variations GET parameters
Not supported.
User should manually sign.
Likert Scale
Field Format / Variations GET parameters
?wpf771_41_r2_c1=1
?wpf771_41r1_c2[]=1&wpf771_41_r3_c1[]=1
r1 indicates first row, c2 indicates second column, etc.
Supports single/multi rows rating scale & multiple responses.
Net Promoter Score
Field Format / Variations GET parameters
?wpf771_42=4
Will select value 4 from 0 to 10.
Payment Coupon
Field Format / Variations GET parameters
?wpf771_1=coupon%20code
Single Item
Field Format / Variations GET parameters
?wpf771_43=10
Supports only “User Defined” Item Type.
Multiple Items
Field Format / Variations GET parameters
?wpf771_44=Second%20Item
(text and image choices)
Field Format / Variations GET parameters
?wpf771_45=Second%20Item
Credit Card
Field Format / Variations GET parameters
Not supported.
User should manually enter credit card data.
Total
Field Format / Variations GET parameters
Not supported.
Value is calculated using JavaScript on page load.

Using the prefill setting

In the tutorial link above, the idea is to have your visitor see the first form and complete some basic information. Then pass that information on to another form with the Submit button.

In order to achieve that, you’d need to set up your Confirmation Type to Go to URL (Redirect) and use this setting for the fields above to populate that query string.

An example is adding this URL to the Redirect URL. http://mydomain.com/contact?contact-reason=Events%20and%20Parties

Using the Enable Prefill By URL setting to populate a query string

And that’s it! For another specific example of this in action, check out this tutorial on How to Use Query Strings to Pre-Populate Form Fields From Another Form. For other examples, please check out our article on How to Use Query Strings to Auto-Fill a Text Field.

FAQ

Q: How do I use this for sublabels?

A: When using this to pre-populate a Name or Address field that could have several subfields, we’d like to share an example with you.

?wpf1036_1|first={field_id="1|first"}&wpf1036_1|last={field_id="1|last"}&wpf1036_3|address1={field_id="3|address1"}&wpf1036_3|address2={field_id="3|address2"}&wpf1036_3|city={field_id="3|city"}&wpf1036_3|state={field_id="3|state"}&wpf1036_3|postal={field_id="3|postal"}

  • For details on how to locate a Form ID or Field ID, please see our tutorial.
  • As a general rule, the maximum length for a URL is 2,000 characters.