1. Help
  2. Features
  3. Hidden fields

Using Hidden Fields

Introduction

Hidden fields are a type of field that is not visible to the user. They can be used for storing and processing data that the user does not need to see or interact with. Note that hidden fields are different from fields that are made hidden or invisible using conditional logic.

Adding a hidden field

You can add a hidden field via Add Field → Hidden on the form editor page. A hidden field has two configuration options: the label of the field, and the value.

Hidden field on the form
Hidden field

When you click on the cog icon to edit the field you can see the field ID on the top-left corner. Note this field ID as we will use it below.

Setting the field value

Since the field doesn’t ask for user input, you can set the value of the hidden field in a few different ways:

Static value

If you want the hidden field to always have the same value, you can simply type it in the value field when editing the field in the form editor.

Prefilled value

A common use case for hidden fields is to prefill them with data from the URL. This can be done by adding a query parameter to the form URL that contains the value you want to prefill.

For example, if you want to prefill a hidden field with the value 123, you can add ?field4=123 to the URL.

When using URL prefill you can either use the field ID or the field label. If our hidden fields is labelled username you can use ?username=123 to prefill the field.

Learn more about form prefilling here.

Calculated value

You can use math calculations in the value of a hidden field. This allows the hidden field to store the result of a math formula which can contain inputs from other fields.

Simple form showing math calculations via hidden field
Storing calculation results in hidden fields

In the above example we have two input fields, with the IDs field1 and field2. We are using a hidden field to store the sum of the two input fields. The value of the hidden field is set to {field1 + field2}.

Now if you want to reference the sum again (example in another rich text field) you can simply reference this hidden field, instead of having to use the math calculation in multiple places.

One good example to look at is our mortgage calculator form , which uses hidden fields to calculate and store the Future value factor.

Conditional value

You can use conditional logic to set the value of a hidden field.

For example, saw we are building an approval form. In the backend we use the value of the hidden field labelled manual_approval to determine if the form needs manual approval.

Conditional logic step to set the value of a hidden field
Using conditional logic with 'set value'

In the above example, we are setting the value of manual_approval to yes if either of the two conditions are met:

  1. The Amount is greater than 1000.
  2. The Amount is greater than 500 and Request type is Initial.