What is pre-filling and how does it work?

Pre-filling is for when you already know some of the answers before your users come to their form, you can pre-fill those answers for them!

How to pre-fill an answer to a question

Pre-filling answers is really easy! Every question has unique key for pre-filling, called it's pre-fill key. You can use this key as an argument in the URL to pass an answer.

The pre-fill key for a question is located at the bottom of the question's "Configure" section (pictured below).

You can then use this key on the form's URL by adding a "?" to the end (if there isn't one) and then writing KEY=value.

You can add multiple answers to a form by adding in an "&" in between the answers.

Here's an example of how it works with a form URL https://paperform.co/form/prefilling. With two answers pre-filled with the keys 1sgr2 and 1q797, the URL would look like this https://paperform.co/form/prefilling?1sgr2=Answer 1&1q797=Answer 2.

How to pre-fill on an embedded form

Pre-filling on an embedded form is very similar to pre-filling via the URL. First test the pre-filling directly on the URL. Then copy everything from the URL after the "?". E.g. from the URL in the previous section, you would copy 1sgr2=Answer 1&1q797=Answer 2.

Go to the embed code of your embedded form, and add data-prefill="URL_VALUES" before "data-paperform-id", where URL_VALUES is the copied end of the URL. This would look like:

<div data-prefill="URL_VALUES" data-paperform-id="prefilling"></div><script>(function() {var script = document.createElement('script'); script.src = "https://paperform.co/__embed"; document.body.appendChild(script); })()</script>

Dynamically pre-filling an embedded form

You can also dynamically pre-fill an embedded form, by passing the same URL values in the URL of the page you’re embedded on. You will need to modify your embed script to enable this functionality. The above script would become;

<div data-prefill-inherit="1" data-paperform-id="prefilling"></div><script>(function() {var script = document.createElement('script'); script.src = "https://paperform.co/__embed"; document.body.appendChild(script); })()</script>

Pre-filling emails

If you would just like to pre-fill an email address, there is a shortcut! Instead of using the question's pre-fill key like above, you can simply add ?email=test@test.com to the end of any form URL, and any questions of the type "email" will have the provided answer.

Pre-selecting products

You can pre-select products by passing in the SKU of the desired product.

Pre-selecting multiple choice questions

If the question you are answering needs to have multiple answers, you can simply pass both values in the URL, one after the other. This would look like this KEY=Option 1&KEY=Option 2.

Pre-selecting Yes/No Questions

For Yes/No questions just pass "Yes" or "No" as the answer. Note that case is important.

Pre-filling date fields

Dates can be pre-filled using the format KEY=yyyy-mm-dd.

Pre-filling hidden fields

Sometimes you want to pass information through the URL and not display it to the user. For that exact purpose there is a question of the type "hidden". Hidden fields are never shown to the user, but whatever value they have is still submitted.

pre-fill, prefilling, hidden fields