Overview
You can build a link to prefill any web form. Before you begin, consider the size and content of the link. The more fields you choose to prefill, the longer the link gets, and longer links can easily break. So keep in mind: The shorter the link, the better.
It's also easiest to prefill fields which don't have spaces. Spaces can also cause links to break.
In most cases, however, it's possible to work around these concerns.
Video Tutorial
Learn how to prefill your forms. We go over what types of links, passing from one form to another, passing multiple fields and more.
Prepare to Build Your Link
To build your prefill link, you'll need:
The form's address (URL)
- Go to the Publish page and copy the public address under Your form is publicly available at this address.
If you've published the form on your own website page, you can also use that page's URL. Now, decide which fields you want to prefill.
- Go to the Publish page and copy the public address under Your form is publicly available at this address.
The aliases of the fields you want to fill
- In the Publish page for your FormAssembly form, you'll find a link at the bottom of the page: Show how to prefill form data dynamically.
Click that link to find the field alias(es) you'd like to prefill.
- In the Publish page for your FormAssembly form, you'll find a link at the bottom of the page: Show how to prefill form data dynamically.
Here are the prefill parameters for the form we'll be looking at:
Build Your Prefill URL
You can use a basic text editor to build your link, like Notepad or TextEdit. Here's a form link from the Publish page, where 237760 is the form ID.
https://www.tfaforms.com/237760
Now, copy your form URL from the Publish page, and place a question mark after it. Here's what our example link looks like:
https://www.tfaforms.com/237760?
Next, pick one field alias from the list that you want to prefill, and place it after the question mark. Here, we're using the email field "tfa_16." Add an equals sign after the field alias.
https://www.tfaforms.com/237760?tfa_16=
After the equals sign, you'll want to enter the data that will prefill the form field.
https://www.tfaforms.com/237760?tfa_16=name@domain.com
Or you can use a merge field from an email system.
Salesforce
https://www.tfaforms.com/237760?tfa_16={!Contact.email}
MailChimp
https://www.tfaforms.com/237760?tfa_16=*|MERGE0|*
Prefilling a Multiple-Choice Field
List, Radio Button, or Drop-Down Menu
When prefilling a selection list, radio button, or drop-down menu field, the question has an alias, and so the does the choice.
You'll be placing the alias of the question before the equals sign and the choice alias(es) after the equals sign.
You can use the choice's field alias as the value.
tfa_11=tfa_12
Or you can use the exact text of the choice.
tfa_11=Lettuce
In this example, the question is a menu list, where you can select multiple answers by separating them with a semicolon.
tfa_11=Lettuce;Onion
Checkboxes
Checkboxes work a little differently than other multiple-choice fields.
The alias before the equals sign is the choice alias. The question has no alias.
When you're using checkboxes, you can use a 1 (which means "TRUE") to check a box or 0 (which means "FALSE") to uncheck a box.
tfa_19=1 or tfa_19=0
Or, you can use the exact text to fill the field.
tfa_19=Yes
If you are building a prefilling redirect link, you can use a formula like the one below to pass the value of a checkbox field. You will not be able to pass a checkbox value without using a formula like the one below.
https://www.tfaforms.com/237760?@IF(%%tfa_2%%,"tfa_3")
The formula above says, if there is a checkbox value for tfa_2 in the first form, pass that checked value to the tfa_3 checkbox in the second form.
To create a prefilling redirect link like this, you will need the field aliases for the specific checkboxes on each form.
With checkboxes, you must do a one to one checkbox mapping. In other words, you cannot use the field alias for a checkbox question, you must use the aliases for the individual checkbox selections.
Prefill More than One Field
To prefill more than one field, you can add more field aliases with their value, separated by an ampersand (&).
https://www.tfaforms.com/237760?tfa_17=name@domain.com&tfa_17=MyFirstName&tfa_21=MyLastName
Repeat this as needed, but remember that the shorter the link, the better.
Pass Data Between Forms
If you're passing data between FormAssembly forms, you'll want to place the first form's value aliases nested inside double percent (%%) signs.
https://www.tfaforms.com/xxxxxx?tfa_email2=%%tfa_email1%%
In the example above, tfa_email1's value from the first form will be passed to the field tfa_email2 on the second form.
Once you are finished building the URL, place the URL in the redirect field in the Notifications page of your first form.
The "POST" Method
You can also use the "POST" method to prefill your forms. Users with advanced technical expertise can pre-populate a web form dynamically by "posting" data to the web form itself. This method is most helpful when passing data that does not pass well through the URL, like multi-line text fields.
Here's a short example. This first form prefills the "subject" field in a second form, FormAssembly's Contact Form:
Here's the corresponding HTML:
<form action="https://app.formassembly.com/forms/view/237760" method="POST" > <input type="text" name="wf_Subject" value="subject goes here"/> <input type="submit" value="Open the Contact Form" /> </form>
The form will accept a HTTPS POST request and match submitted name/value pairs with its own field names. Unknown fields are ignored. Matching fields will take the submitted value.
To find the field name used in your form, inspect the HTML source, or:
- Go to the Form List and click configure on the form you need to set up. This opens the form properties panel on the left-hand side.
- On the Publish page, click the Show how to prefill form data dynamically link.
Prefill Repeatable Fields and Sections through the URL
It is possible to prefill repeatable fields and sections through the URL.
To do so, you must first view the live version of your form, and click on the repeatable link to make an additional field or section appear.
Once you have clicked on that link, you should then right click on the "Add another response" text and choose "Inspect."
This will show the HTML code behind the form. You will want to look for the section that provides the ID for the "add another response link". It should be highlighted, and will look something like this:
In the example above, the ID is "tfa_1-D[0]-wfDL"
You can now begin building your prefilling link using this value. An example would be:
www.tfaforms.com/123456?tfa_1-D[0]-wfDL
Next, you will need to put an equal sign, and the number of times you would like that repeating field or section to be triggered to appear. For example, if you were planning on prefilling 4 fields total (the original field plus 3 repeats), your link would look like this:
www.tfaforms.com/123456?tfa_1-D[0]-wfDL=3
Next, you will need to right click on the actual field you are wanting to prefill, and select "Inspect" again.
Just like before, you will want to look for the ID of the field. It should be highlighted, and it will look like this:
So the ID for the example above would be tfa_1[0].
Now, you can use that value to continue building your prefilling link by adding an ampersand and the value you would like to prefill:
www.tfaforms.com/123456?tfa_1-D[0]-wfDL=3&tfa_1[0]=A
That link would trigger the repeated field to appear 3 additional times, and would fill the first field with the value "A."
In order to fill all four form fields that were triggered to appear with values, you would need a link like this:
www.tfaforms.com/123456?tfa_1-D[0]-wfDL=3&tfa_1[0]=A&tfa_1[1]=B&tfa_1[2]=C&tfa_1[3]=D
It's important to note that the number in the bracket increases by 1 for each additional repeated field, while the number in the alias does not change. For example, tfa_1[0], tfa_1[1], tfa_1[2], and tfa_1[3].
You could use this same approach for prefilling repeatable sections, you would just need to inspect all the fields in the section in order to determine their ID.