# Forms

> Publish a page anyone can fill in. Each accepted answer adds a row to one of your tables and can start a flow. Covers field types, limits, the bot check, cost and closed states.

Source: https://docs.go-lumen.ai/he/approvals/forms

A **form** is a page that anyone with the link can fill in, with no Lumen account. Each accepted answer becomes a row in a table of yours, and can start a flow. Use one to collect supplier details, requests or sign-ups.

-   Any workspace
-   Public link
-   0.1 credit per accepted answer

This is not the form of an [approval](https://docs.go-lumen.ai/he/approvals/approvals.md). An approval form is one step in one run: it goes by email to one person, once, and the run waits for it. A public form is a standing page that anyone can submit any number of times, and every answer is a new row.

|  | Public form | Approval form |
| --- | --- | --- |
| Address | `/f/<slug>` on your app host | `/forms/<token>`, one signed link per run |
| Who answers | Anyone with the link, behind a bot check | The person the email was sent to |
| Answers go to | A row in a table | Fields of one run |
| How often | Many times, until it closes | Once |
| Made in | A table's **Forms** tab, or a `Form` resource | An [`approval`](https://docs.go-lumen.ai/he/reference/nodes/approval.md) node in a flow |

## Make a form

**Console:**

1.  Open **Databases**, pick the database and then the table that should receive the answers.
2.  Switch from **Rows** to **Forms** and click **Make a form**. The form starts with fields made from the table's columns.
3.  In **Edit**, change each question's text and **Help text (optional)**, tick **Required**, and reorder, add or remove fields. **Add a field from the table** lists the columns not yet asked.
4.  On the right, set **Title**, **Description**, **Message after sending** and **Language of the page**, and switch **Taking answers** on.
5.  Use **Preview** to see the page, then click **Save**. **Copy link** gives you the address to share.

![The Forms tab of the Suppliers table. A line says a form is a page anyone with the link can fill in and every answer is added to this table as a row. A Make a form button is on the right. The table lists one form, Become a supplier, open, with 3 answers, starting 1 flow, at /f/become-a-supplier-demo, with icons to copy, link, edit and delete.](https://docs.go-lumen.ai/he/img/approvals/forms-01-forms-tab.png)

*A table's Forms tab lists its forms with their answers, the flows they start and their link.*

![The form editor. On the left four question cards: Company name (short text, required), Contact email (email, with the help text Where we send our reply.), What do you supply? (choose one) and Years in business (number), each with move and remove buttons, and Add a field from the table below. On the right Title, Description, Message after sending, Language of the page (English or Hebrew) and a Taking answers switch. Above are Edit and Preview, Use in a flow, copy link and Save.](https://docs.go-lumen.ai/he/img/approvals/forms-02-form-editor.png)

*The editor: questions on the left, the form's settings on the right.*

![The public page of the form: a white card titled Become a supplier with its description, then Company name (required), Contact email with the help text Where we send our reply., What do you supply? as a dropdown, Years in business, and a blue Send button. Made with Lumen is written below the card.](https://docs.go-lumen.ai/he/img/approvals/forms-03-public-page.png)

*What the person sees at the form's link.*

The builder covers questions and the page. Limits, patterns, prefill and a redirect after sending are set in YAML.

**YAML:**

A form targets a table, so the table comes first.

```yaml title="suppliers-form.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Sheet
metadata:
  name: suppliers
  namespace: tenant-acme
spec:
  displayName: Suppliers
  baseRef: finance
  columns:
    - {name: name, title: Company name, type: text, required: true}
    - {name: email, title: Contact email, type: text}
    - {name: category, title: Category, type: choice, choices: [Food, Utilities, Office, Delivery]}
    - {name: years, title: Years in business, type: number}
---
apiVersion: lumen.ai/v1alpha1
kind: Form
metadata:
  name: become-a-supplier
  namespace: tenant-acme
spec:
  displayName: Become a supplier
  description: Tell us who you are and what you supply. We reply within two working days.
  lang: en
  target: {base: finance, sheet: suppliers}
  pages:
    - fields:
        - {name: name, label: Company name, type: text, required: true}
        - {name: email, label: Contact email, type: email, help: Where we send our reply.}
        - {name: category, label: What do you supply?, type: select}
        - {name: years, label: Years in business, type: number}
  limits:
    perDay: 200
    closeAt: "2027-03-31T21:00:00Z"
  after:
    message: Thank you, we will be in touch.
  open: true
```

The `slug`, the form's address, is generated when you leave it out: a readable prefix and a random tail, so it cannot be guessed from the name. It is fixed afterwards, because changing it would break the links already shared. It is written into `spec.slug`, and the **Link** column shows the address.

## Fields and columns

Each field's `name` is the column its answer is written to, so it must match a column of the target table. A form must ask for every column the table marks required, or it is refused when you apply it.

| Field type | Page shows | Fills a column of type |
| --- | --- | --- |
| `text` | Short text, up to 500 characters | text |
| `longtext` | A larger box, up to 10,000 characters | text |
| `email` | Text that must be an email address | text |
| `phone` | Text that must look like a phone number | text |
| `number` | A number | number, money |
| `date` | A date | date |
| `checkbox` | A checkbox. Unticked is `false`. | true or false |
| `select` | Choose one | choice, or a select column that takes one value |
| `multiselect` | Choose several, up to 100 | a select column that takes several |

A computed column (a formula) cannot be filled. `file` is reserved for uploads and is refused for now.

Other field settings:

-   `required`, `help` (up to 500 characters), `placeholder`.
-   `options` for a select field, up to 100. Left out, the field offers the column's own options. Each option must be one the column accepts.
-   `pattern` for a text-like field: a regular expression the whole answer must match, checked by the page and again by the server. `patternMessage` (`en` and `he`) is what the person is told.
-   `prefill` fills a field from another field of the form until the person edits it, for example a workspace name made from a company name with `format: slug`.

A form holds a list of pages (up to 20), but only one page is shown today: multi-page forms are planned. Conditional fields (`showIf`) are accepted and ignored for now.

## Limits and closing

| Setting | Closes the form |
| --- | --- |
| `open: false` (**Taking answers** off) | At once, until you switch it back on. |
| `limits.closeAt` | At that time. |
| `limits.perDay` | After that many accepted answers in a day (UTC), until the next day. |

A form also reads as closed when the table is full, or when the workspace has used its monthly credit budget. The page says why:

| State | The person reads |
| --- | --- |
| Switched off | This form is closed and is not taking answers. |
| Past `closeAt` | This form has ended and is not taking answers. |
| Over `perDay` or table full | This form has reached its limit for today. Please try again tomorrow. |
| Budget used | This form is closed for now. |
| No bot check on this installation | This form is not ready yet: the bot check is not set up. |

After an accepted answer the person sees your **Message after sending**, or the default "Thank you, your answer was received.". Set `after.redirect` to an `https` address to send them somewhere instead. A message and a redirect cannot both be set.

## Protection and cost

A public form has no sign-in, so two things stand between the page and your table:

-   **A bot check.** The page shows Cloudflare Turnstile, and the server verifies the token before it accepts an answer. An installation with no bot check set up refuses answers.
-   **A rate limit.** One address can send 5 answers an hour to one form. More gets "Too many answers from here. Please try again later."

An accepted answer costs **0.1 credit**, booked to the workspace, when its plan charges credits. A refused or invalid answer costs nothing. Lumen keeps a log of accepted answers for 90 days (a hashed address and the row, never the answers) for the rate limit and the audit; the answers themselves are the rows in your table.

Answers are checked against the form and then against the table. A table with a key refuses an answer that repeats an existing key: "this answer was already sent".

## Start a flow from a form

The **A form is submitted** trigger ([`form-submitted`](https://docs.go-lumen.ai/he/reference/triggers/form-submitted.md)) starts a run for every submission, with the answers as fields typed like the table's columns. It also gives `rowId`, `submittedAt`, `formName` and `lang`. In the console, the **Use in a flow** button on a form starts a new flow with this trigger.

```yaml title="new-supplier.yaml (the flow's spec)"
spec:
  triggers:
    - id: submitted
      ref: {name: form-submitted}
      config: {form: become-a-supplier}
      next: [tell]
  nodes:
    - id: tell
      stepRef: {name: send-email}
      config:
        to: procurement@acme.example
        subject: "New supplier: {submitted.name}"
        body: "{submitted.name} supplies {submitted.category}. Contact: {submitted.email}."
```

The `form` setting names a [`Form`](https://docs.go-lumen.ai/he/reference/resources/form.md) of the workspace. The editor lists the form's questions as the trigger's fields, so later steps can pick them.

The row is already in the table when the run starts, so the flow can update it by `rowId`. See [Databases and tables](https://docs.go-lumen.ai/he/data/databases-and-tables.md).

## Next steps

[Databases and tablesThe tables that forms write to, and their column types.](https://docs.go-lumen.ai/he/data/databases-and-tables.md)[TriggersHow a form submission starts a flow, beside email and schedules.](https://docs.go-lumen.ai/he/build/triggers.md)[ApprovalsA form for one person, inside one run.](https://docs.go-lumen.ai/he/approvals/approvals.md)[Credits and budgetsHow the 0.1 credit per answer counts against your budget.](https://docs.go-lumen.ai/he/concepts/credits-and-budgets.md)
