Skip to main content

Build standalone forms

Learn how to build standalone forms and record responses to your database.

info

Retool Forms is available on Retool Cloud and self-hosted Retool versions 3.36 and later.

Use Retool Forms to build standalone, customizable forms whose responses are written to your database. Forms are publicly accessible from a unique URL.

To build forms within apps, use the Forms component.

Requirements

All users can create and fill out forms. You can build as many forms as you'd like and capture as many responses as your database supports.

To connect forms to an existing database, you must connect the database as a resource in Retool. To use Retool Database to store responses on self-hosted Retool, you must first configure Retool Database. On cloud-hosted Retool, no additional configuration is required to use Retool Database.

1. Create a form

Go to the Forms tab and select Create form. Name your form and select Create form.

2. Connect your data

In the Database tab, select Generate from database to write responses to an existing database, or Start from scratch to store responses in Retool Database. From the Database tab, you can change the underlying database at any time.

If you create your form from scratch, a new table is automatically generated when you publish your form. Generated tables are named after your form.

If your database schema changes as you build your form, you can select ... > Sync from database to view and sync schema changes to your form.

3. Build your form

You can use the sidebar to reorder your form, and use the drag-and-drop form editor to customize individual fields.

Use AI to generate fields

If you use Retool Database, you can use AI to generate a form for your use case. From a blank form, select Click here to start with AI, and provide your use case. Fields are then automatically generated, which you can further customize. A table named after your form is created when you publish the form, and contains columns for each input field in your form.

Add presentation fields

You can add Text, Image, and Divider fields from the + button. These can help you organize your form and provide additional context to users. Presentation fields do not affect data written to your database.

Add custom fields

You can add custom fields to forms connected to Retool Database. When you publish your form, a column is inserted into your database with the settings from the custom field. Custom fields default to use the name of the input component, so you may want to change this name before you publish.

Hide fields

It can be useful to hide database fields, especially those which have default values set by your database, from your form.

When you hide a field from the sidebar, the field is not passed to the database insert request. You may want to use this to hide id, created_at, or other auto-generated fields, so your database can handle these inserts.

To hide a field from users, but still include it in the database insert request, use the Hidden field in the field settings. You can use this conditionally hide fields based on any criteria. For example, to hide a custom_name field when the status field is not 'new', you could set Hidden to {{ status.value !== 'new' }}. When the status field is not new, the custom_name field is set to null.

Delete fields

You can delete fields from your form by clicking the delete icon. Non-presentation fields must be hidden before you can delete them.

4. Connect a workflow

info

Triggering Retool workflows from form submissions is currently rolling out for self-hosted Retool.

From the Workflows tab, you can trigger a Retool workflow on successful form submissions. Ensure your workflow has webhook triggers enabled. All form fields are passed as workflow parameters.

5. Set themes

In the Settings tab, you can customize the color, typography, and border radius on your form to match your organization's branding.

6. Preview and publish your form

To preview your form before you publish it, select the preview icon in the upper right. To generate a shareable URL for your form, select Publish in the upper right. Once published, the form is accessible to any user given the unique URL.

Autofill forms with URL parameters

You can pass default URL parameters to forms, similar to how you pass parameters to apps. Use the urlparams object to populate default values.

For example, if you set a Quantity form field's default value to {{ urlparams.quantity }}, passing the query string ?quantity=5 in the URL pre-populates the field with 5.

7. Use form responses

After you publish and distribute your form, select the Responses tab to view form responses. Responses are read-only, but you can click Clone as Retool app to copy the data to an app, or Download to download the data as a CSV.