Prepopulating Fields
If you are embedding a form in a context where your users are logged in, asking them to provide their email addresses might be a little awkward. Instead of doing that, you can prepopulate certain fields by modifying the URL in the embed script. This works especially well with hidden fields in Reform (fields that aren't rendered in the form).
We now offer an enhanced feature for setting hidden fields through URL query parameters. In addition to using the field ID, you can now use the hidden field name to prepopulate these fields. You can choose the name of your hidden field directly on the form builder page.
Here's how it works:
- On the form builder page - click on "Add form block" and select the "Hidden" field from the dropdown.
- A hidden field will be automatically added to the form.
- Click inside this field (where it says "Enter a column name") and type in the desired name (e.g., "user_id").
When you go to the "Share" page, the link for the form will be available under "Copy link".
To prepopulate this hidden field with a value, follow these steps:
- Scroll down until you find the hidden field, which should be named with the name you chose for it on the builder page (in this example, "user_id").
- Enter the value you want to prepopulate the field with (for example, "1234").
After you enter the value in the field, the URL under "Copy link" will automatically update to include the hidden field's name and value. You can simply copy the already created URL and start using it. For example, the updated URL will look like this:
https://forms.reform.app/y6xYcg/work-with-us-1/dVoR1v?user_id=1234
Alternative Method (using the field ID):
In addition to using the field name to prepopulate these fields, you can also use the field ID. Here's how:
- Get the field ID by clicking the ⚙️ icon in the form builder.
- Copy the form URL from the "Share" page.
- Manually add the field ID and the value you want to prepopulate with at the end of the URL.
For example, if the field ID is "331149da-a744-4212-99eb-b5c899f86d31" and you want it to be prefilled with the text "John Doe", the URL will look like this:
https://forms.reform.app/example/form?331149da-a744-4212-99eb-b5c899f86d31=John%20Doe
The "%20" is how a space looks in a URL when it's URL encoded.
While this method works, it requires manual modification of the URL, making the field name method more convenient.
If you still have any questions or concerns, please feel free to send us an email: [email protected]