How to prefill forms dynamically with existing data

Sending out surveys regularly? Pre-filling forms can help respondents complete them quickly. Baserow has a solution for auto-filling responses.

Pre-filled forms automatically populate each field with information, reducing workload and prompting action. When a respondent clicks on a pre-filled form link, some answers are already filled in, eliminating the need to fill out each field individually.

What we’ll cover

This tutorial will cover how to share a Baserow form with information prefilled.

  • Create a data structure
  • Configure form view
  • Prefill syntax
  • Hide form fields dynamically
  • Use formulas to prefill form dynamically
  • Encode and add fields to the formula function

1. Create a data structure

Create or log in to your Baserow account.

The next step is to create a workspace. A workspace is a workspace where you can store multiple databases and invite collaborators.

Next, create a workspace to store multiple databases and invite collaborators.

Create a database, which consists of tables containing rows and columns.

For this tutorial, we’ll work with the User Feedback template. Add it to your workspace by clicking the ‘Use this template’ button.

https://baserow-backend-production20240528124524339000000001.s3.amazonaws.com/pagedown-uploads/9ba3e5fc-507f-4348-9af9-2eb7ed9deaa5/Screenshot\_2023-02-03\_at\_11.03.34.png

The User Feedback database has three tables: Users, Feedback submissions, and Features. In the Feedback submissions table, we want to capture the ‘Submitted by’ data using a Link to table field.

https://baserow-backend-production20240528124524339000000001.s3.amazonaws.com/pagedown-uploads/4baead64-31d7-40eb-8e5f-7dad095cf457/Screenshot\_2023-02-03\_at\_11.57.30.png

This table also has a Feedback form view to receive feedback.

2. Configure form view

If you don’t have a Feedback form view in your table, create one.

Forms can be automatically created from your database. Build forms easily with click-to-add functionality from the Feedback form view sidebar.

After setting up the form, create a private shareable link to make it public.

https://baserow-backend-production20240528124524339000000001.s3.amazonaws.com/pagedown-uploads/f4dea617-d372-4e87-82cd-a4bf8e317b63/Screenshot\_2023-02-03\_at\_11.19.31.png

The form URL is pre-generated by Baserow. Once you get the form URL, you can add parameters in the form URL to prefill fields.

3. Prefill syntax

To pre-fill the form with existing data, add query parameters to the share form URL.

Prefill query parameters are prefixed with prefill to avoid any collision with potential future query parameters. URL parameters are made up of a key (<field_name>) and a value (<value>), separated by an equal sign (=). Multiple parameters are each then separated by an ampersand (&).

  1. Copy your share form URL
  2. Append query params to the end of a URL, add a ‘?’ followed immediately by a query parameter
  3. Type prefill_ and the name of the form field you wish to prefill. The part after prefill_ must exactly match the field name as it appears in the form.
  4. After inputting the form field name, type the value that you would like the field to be prefilled with, starting with the = equals sign: ?prefill_<field_name>=<value>
  5. Encode query string parameter name and/or value for various symbols to avoid any issues with the query parameter.

Spaces in the field name are replaced with +, while Spaces in a pre-filled answer are replaced with %20. E.g. ?prefill_first+name=Mike%20Smith will prefill a field called first name with the value of Mike Smith. Note that the values are case-sensitive.

e. To prefill more form fields, enter an ampersand (&) and then enter more prefill_ parameters in the format: ?prefill_<field_name>=<value>&prefill_<field_name>=<value>. Separate multiple select fields with a , comma between the values.

4. Hide form fields

You can prefill a field that you do not want the respondent to edit, such as user data, internal ID or a support ticket number. We may not want to give them that access to view or edit all other table data. An alternative would be to prefill the field with the data and then hide that field.

To hide a field dynamically, you can do so via query parameters added to the public from the URL. The query parameter is prefixed with hide_ encoded URL parameter to avoid collision with potential future query parameters.

<https://baserow.io/form/Be_3bysp4BkzhyinMEpKchhWJVCpPpPH2XH4HNvVudQ?prefill_Submitted+by=Carmelo%20Aguilar&hide_Submitted+by>


This formula hides each of the prefilled fields selected. The hidden form field will not be shown to the respondent. However, the prefilled value will still be entered into the row when the form is submitted.

Don’t prefill values that violate privacy or compliance policies. The prefilled value appears in the URL and the respondent’s browser’s address bar. If the respondent deletes the econded URL components from the address bar, the hidden form fields will appear in the form.

Next, let’s populate the form with existing data from your table using these URL parameters and the formula field.

5. Use formulas to prefill form dynamically

Creating many prefilled form URLs manually for each unique row is error-prone and tedious. Use Baserow’s formula field to automatically prefill form URLs for new rows.

Create a formula field in the Users table and join multiple strings together as a single piece of text. This way the dynamic form URL can be linked to the row.

In the formula builder, add the generated share URL from the feedback form with quotes around it: '<form-URL'

https://baserow-backend-production20240528124524339000000001.s3.amazonaws.com/pagedown-uploads/082b8e6c-760f-42ae-948a-76b0e0d4e82f/Screenshot\_2023-02-03\_at\_12.07.28.png

Every row will be populated with a pre-filled link.

6. Encode and add fields to the formula function

Generally, the prefilled value is the same as the value of the field. But there are some exceptions where the value is translated to a different value. Special field types are: Link to table, Single select, Multiple select, Rating, and Date.

In this tutorial, we will pre-fill the Feedback form with the user’s name—a Link to table field. A link to table field can accept the value that is shown in the select dropdown.

Create a new formula field to append query parameters to the form’s URL.

The formula will be dynamically set up based on the form and table so that every new row has a unique prefilled form:

  1. Append the form URL with the user’s data using a concat( ) function in the formula builder.
  2. Reference the Feedback form formula field created, e.g. concat(field('Feedback form')
  3. Input the name of the form field to be prefilled as shown in the form. This element will be static and thus wrapped inside quotations, e.g. '?prefill_Submitted+by='
  4. Append the table field to be dynamically prefilled for each row to populate the user’s data, e.g. field('Name')
  5. Combine the arguments with a , and ensure any special characters are URL encoded.
concat(field('Feedback form'),'?prefill_Submitted+by=',field('Name'))


  1. To prefill more information about the respondent, add an ampersand between variables
  2. Wrap the concat() function with the replace() function. This is because we want any spaces in the formula to be replaced with the + character so that the outputted URL is properly encoded.
replace(concat(field('Feedback form'),'?prefill_Submitted+by=',field('Name'),'&hide_Submitted+by'), " ", "%20")


  1. Copy and share the pre-filled link.

https://baserow-backend-production20240528124524339000000001.s3.amazonaws.com/pagedown-uploads/2529898d-2bf5-4a64-8916-4d06c8a1c384/Screenshot\_2023-02-09\_at\_22.05.18.png

When accessed, the URL will prefill the form for the respondent.

If you need help prefilling forms, or simply want to share how you use Baserow, join us in the Baserow community!

What’s your use case? Tell us how you use Baserow