> For the complete documentation index, see [llms.txt](https://docs.lleverage.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lleverage.ai/build-and-improve/automate/build-a-workflow/form.md).

# Form

Form actions are canvas actions that work with App triggers to create user-friendly data collection interfaces. When published, they become standalone form applications that anyone can use to submit information to your workflow.

### How to Configure a Form Action

1. Select "App" as your trigger type
2. Choose "Form" as your canvas action
3. Click "Add Field" to create a new input field
4. Enter the name of your field
5. Select the field type from the dropdown menu
6. Click "Create" to add the field to your form
7. Repeat steps 3-6 to add additional fields as needed

> 💡 When you create a field, it automatically generates a variable chip that you can use to pass the output throughout your workflow.

### How to Edit Form Fields

1. Locate the field you want to edit on your form
2. Click the pencil icon next to the field
3. This opens the field configuration panel where you can modify:
   * **Variable Name**: The name used to pass data through the workflow
   * **Label**: The display name shown to users (defaults to variable name if not edited)
   * **Field-specific settings**: Varies by field type

> ⚠️ If you delete the label, it will default to the variable name. You can add variables within labels.

### Available Field Types

#### Text Field

**Input Options:**

* Single-line or multi-line text input
* Multi-line option affects styling presentation

**Configuration Options:**

* Label
* Default value
* Placeholder text
* Hint text
* Minimum length
* Maximum length
* Multi-line toggle

#### Number Field

**Input Options:**

* Standard input field
* Slider input (can be checked/enabled)

**Configuration Options:**

* Required field toggle
* Label
* Default value
* Placeholder text
* Hint text
* Minimum value
* Maximum value

#### Toggle Field

**Input Options:**

* Switch style
* Checkbox style

**Configuration Options:**

* Required field toggle
* Label
* Default value (true or false)
* Hint text

#### Single Select Field

**Input Options:**

* Dropdown menu
* Radio buttons

**Configuration Options:**

* Required field toggle
* Label
* Default value (dropdown selection)
* Placeholder text
* Hint text
* Selection options (add and reorder options)

#### Multi-Select Field

**Input Options:**

* Multiple selection interface

**Configuration Options:**

* Required field toggle
* Label
* Placeholder text
* Hint text
* Selection options (add and reorder options)

#### Date Picker Field

**Configuration Options:**

* Label
* Default value (year, month, day format)
* Placeholder text
* Hint text

#### File Field

**Configuration Options:**

* Label
* Placeholder text
* Hint text
* File type restrictions
* File size limits

#### Look Up Field

**Configuration Options:**

* Connects to external data sources
* Dynamic field population
* Search and selection capabilities

#### Item List Field

**Style Options:**

* Card list display
* Table display

**Configuration Options:**

* Required field toggle
* Label
* Hint text
* Form structure for list items
* Initial items (pre-populated entries)
* Allow users to add more items toggle
* **Allow users to delete items** toggle (on by default)
* Inline edit toggle (Table style)
* Add summary to numbers toggle (Table style): a totals row that adds up each number column. It is on by default.

> 💡 The Item List field creates a table-like structure where users can add multiple entries with the same field structure.

The **Allow users to delete items** switch controls row-delete buttons in both list and table styles, including Requests, Apps and the form preview. Turning it off leaves editing, moving, duplicating and feedback available. This is a form-interface control, not a server-side data permission.

### Calculated Fields

A calculated field works out its value from other fields while the person fills in the form, so nobody has to type a figure the form can work out itself. Use it for a VAT amount and total, a due date, or what is left to allocate.

#### How to Calculate a Field

1. Open the field settings with the pencil icon.
2. Under **Default Value**, choose **Calculated** instead of **Fixed value**.
3. Write the **Formula**. Type `@` to pick a field or a function from a list.
4. Choose a **Behaviour**.

Calculated values are available to your workflow like any other field, and they are submitted with the form. Only text, number, date and toggle fields can be calculated. A Record or Item List field cannot.

#### Behaviour

| Behaviour                                | What happens                                                                                                               |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Always calculated (cannot be edited)** | The field always shows the result. Nobody can type in it.                                                                  |
| **Suggested (can be overridden)**        | The field follows the result until someone types a value of their own. One click brings the calculated value back.         |
| **Filled in once, then editable**        | The field is filled the first time the formula has a result. After that it is an ordinary field and is never recalculated. |

#### Writing a Formula

* Refer to another field by its **Variable Name**, for example `net_amount`. A field that is itself calculated can be used too.
* Refer to a column of the record picked in a Record field with a dot, for example `vat_code.rate_pct`.
* Use `+ - * /`, brackets, comparisons (`==`, `!=`, `<`, `<=`, `>`, `>=`), `&&`, `||`, `!` and `condition ? this : that`.
* Available functions: `round`, `floor`, `ceil`, `abs`, `min`, `max`, `sum`, `avg`, `count`, `addDays`, `addMonths`, `startOfMonth`, `endOfMonth`, `daysBetween`, `if`, `isEmpty`, `coalesce` and `concat`.
* Dates are written `YYYY-MM-DD`. There is no function for today's date, so a date has to come from a field.
* Numbers are exact decimals, and `round` rounds halves away from zero, so `round(1.005, 2)` is `1.01`.
* A formula can be up to 1,000 characters long.

If any value a formula needs is empty, the formula has no result: a field that is always calculated shows nothing, and a suggested field is left as it is. To count an empty value as zero, use `coalesce`, for example `coalesce(vat_amount, 0)`.

> ⚠️ A field the form cannot calculate, for example because the formula has a typo, names a field that does not exist, or two fields wait on each other, stays an ordinary field. The form editor marks it so you can fix it.

#### Example: VAT amount and total

An invoice form has a **Net amount** (Number), a **VAT code** (a Record field that picks from a table with a `rate_pct` column), a **VAT amount** and a **Total** (both Number).

| Field      | Formula                                          | Behaviour                     |
| ---------- | ------------------------------------------------ | ----------------------------- |
| VAT amount | `round(net_amount * vat_code.rate_pct / 100, 2)` | Suggested (can be overridden) |
| Total      | `net_amount + vat_amount`                        | Suggested (can be overridden) |

When someone enters a net amount of 400 and picks a VAT code of 21%, the form fills in a VAT amount of 84 and a total of 484. A different VAT code changes both. If the supplier's invoice shows a VAT amount of 84.01, the person types it, the total follows, and the form stops overwriting the VAT amount.

#### Calculated Columns in an Item List

A column of an Item List can be calculated in the same way: open the column in the **Item Form**, and choose **Calculated** under **Default Value**. In a column, a name refers to another column of the same row. To refer to a field of the form instead, write `$form.net_amount`. To name the row's column explicitly, write `$row.amount_net`.

A column can be **Always calculated** or **Filled in once, then editable**. **Suggested** is not available for a column.

A form field can add up a column, for example `sum(booking_lines.amount_net)` for the **Booking lines** list.

**Example: what is left to book**

The invoice form also has a **Booking lines** Item List, shown as a Table, with an **Amount net** column. Two formulas use the same text, `net_amount - sum(booking_lines.amount_net)`:

* A **To book** field, **Always calculated**, shows how much of the net amount is not yet on a line.
* The **Amount net** column, **Filled in once, then editable**, starts each new line with that remainder.

With a net amount of 19,000 and two lines of 12,000 and 5,000, **To book** shows 2,000 and the next line added starts at 2,000.

### Conditional Logic

A rule shows, locks or requires a field depending on the values of other fields. In the field settings, **Conditional logic** has three rules:

* **Show this field when**: the field is shown only when the conditions match.
* **Enable this field when**: the field is shown, but can be edited only when the conditions match. **Disabled display value** sets what it shows meanwhile.
* **Require this field when**: the field must be filled in when the conditions match.

Each condition compares another field with a value: **is**, **is not**, **is any of**, **is none of**, **is empty** or **is not empty**. When there is more than one condition, all of them must match. A Record field is compared by the record itself, not by its label.

* **is** and **is any of** do not match while the other field is empty, so a rule does not apply to a blank form. **is not** and **is none of** do.
* A field that a rule hides or locks does not need to be filled in, is not checked, and is not submitted. A formula that reads it sees it as empty.
* To make a field required every time, use the **Required field** toggle instead.

#### Example: a reason only when it is needed

An invoice form asks for a **Reason for hold** only when **Status** is **On hold**. On the **Reason for hold** field, set **Show this field when** to *Status is On hold*. The field stays out of the form, and out of what is submitted, for every other status.

#### Rules on Item List columns

In the **Item Form** of an Item List, a column's **Conditional logic** compares the other columns of the same row, so one column can be editable on one row, locked on the next and required on a third. On a Booking lines list, set **Require this field when** on **Cost centre** to *Amount net is not empty*: a line with an amount needs a cost centre, and a blank line does not.

### Revisiting an Answer

Once a form is answered, the answer is final by default. Under **Advanced** in the Form step's settings, **Allow revisiting** lets people use **Edit and resubmit** on the latest answer later in the same session. The new response is prefilled with their latest answers and the earlier response stays in the session. Steps that already ran are not undone and every step after the form runs again, including emails and other actions, so only turn it on when those steps are safe to repeat.

### Field Validation and Requirements

* **Required Fields**: Mark any field as required to prevent form submission until completed
* **Field-specific Validation**: Each field type has appropriate validation (number format, file type, etc.)
* **Length Limits**: Set minimum and maximum character limits for text fields
* **Value Ranges**: Define minimum and maximum values for number fields
* **Real-time Feedback**: Users receive immediate validation feedback

### Variable Creation and Usage

* Each form field automatically creates a variable chip for use in subsequent workflow actions
* Variable names can be customized in the field edit panel
* Labels can include variables from other parts of your workflow
* Form outputs are available throughout your entire workflow

### When to Use Form Actions

**Use Form Actions when:**

* You need structured data collection
* Users should provide specific information in defined formats
* You want to validate input fields before processing
* The workflow requires multiple, organized data points
* You need file uploads or complex data structures
* You're collecting tabular data with Item Lists

### Publishing and Sharing

When published with an App trigger:

* Creates a standalone form application
* Generates shareable links
* Provides embed codes for integration
* Works independently of the Lleverage platform
* Can be customized with your branding
* Responsive design works on all devices

> 💡 Form actions create comprehensive variable outputs that make all collected data available to subsequent workflow actions, enabling powerful data processing and automation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lleverage.ai/build-and-improve/automate/build-a-workflow/form.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
