<!-- Built by scripts/build-agent-docs.mjs from site/agents-src/forms.md: edit that file. -->
# Page Lemon forms: guide for AI assistants

> For people: https://pagelemon.com/docs/forms explains this feature in plain words. This page is for AI assistants.

A form is a list of kind `form` in the Lists block: visitors add replies, and only the Workspace Owner and the people allowed to read form replies see them; the emails are Automations. All eight blocks: https://pagelemon.com/agents/blocks.

Contact, enquiry, quote, order-request, waitlist, RSVP and sign-up forms on a site published with Page Lemon. The form is plain HTML on the site's own page, in its design; Page Lemon keeps the questions the person confirmed, checks every answer and keeps the replies. There is no form service to sign up for. Publishing in general: https://pagelemon.com/agents.

Use this when the person asks for a form ("Add a contact form to my site", "people should be able to ask for a quote", "an RSVP form for the wedding"), or when a site you build for them needs one.

## Plans and limits

Limits (replies a month, forms on a site) depend on the plan: https://pagelemon.com/pricing. A refused call says which limit and gives `pricing_url`: pass it on, never retry the same call, and never start or pay for a plan for the person. Say plan names, never ids. Test replies never count.

## Ask the person

Ask in one message, and offer sensible defaults so they can just say yes:

1. **What the form is for** (contact, quote, booking request, sign-up). It sets the defaults below.
2. **The questions**: for each, the wording, the kind of answer (short text, email, phone, a longer message, pick one, tick all that apply, yes/no, date, time, number, link) and whether it must be filled in. Default for a contact form: name, email and message, all required.
3. **Show-or-hide questions**, if any ("phone number, only if they choose to be called").
4. **Where replies go**: the Inbox in the Page Lemon app. An email per reply, or one a day, goes to the email they sign in with only when they chose that in Settings, Notifications (asked when they joined; until they choose, it is one summary a day). The reply's `notification` says which: `queued` (an email is on its way) or `none`. Another inbox, or a message to someone else, is an Automation. The thank-you email to the visitor comes from "<name> via Page Lemon" (`sender_name`, else the site address) and can be replied to only when the person set a reply address: ask for the business's name and the reply address, and set `sender_name` and `reply_to` with `site_update` `action=settings` (`reply_to` alone; it waits for their approval and is used once the address confirms the emailed link). Never pick either yourself.
5. **The thank-you**: the words visitors see after sending, or a page on the site.

## What the person needs ready

Only the list of questions and the thank-you words. Nothing to sign up for, no keys. If the site collects personal data, it needs a privacy notice (templates include one; https://pagelemon.com/docs/privacy-and-data).

## Set it up

`list_save` with the form's key, `kind: "form"`, a name and `form` (its questions and settings). It answers the list's `id`: later changes give `list` with that id and only what changes (`name`, `form`, `owner_columns`).

A form that is worked as a board (Progress, Notes, Tags) gets its own columns from `list_save` `owner_columns: [{key: "progress", type: "choice", options: ["New", "Called back", "Done"]}]`, in the same call that makes the form or in a later one (the list's `etag`). Another service's form (Typeform, GitHub, Calendly) fills a team list or form through an inbound link: `list_make` `action=read_link` with `inbound` (https://pagelemon.com/agents/integrations).

```json
{"site": "site_…", "key": "enquiries", "kind": "form", "name": "Enquiries",
 "form": {
   "fields": [
     {"name": "name", "type": "text", "label": "Your name", "required": true},
     {"name": "email", "type": "email", "required": true},
     {"name": "contact", "type": "select", "label": "How should we reach you?", "options": ["Email", "Phone"]},
     {"name": "phone", "type": "text", "required_if": {"field": "contact", "value": "Phone"}},
     {"name": "message", "type": "textarea", "required": true}],
   "success_message": "Thanks! We reply within a day."}}
```

In `site_spec_save` the shape is not the same: under `lists`, the form's key holds `name`, `kind: "form"`, `fields` (an object keyed by field name, each with a list type: `text`, `email`, `phone`, `long_text`, `choice`, `choices`, `yes_no`, `date`, `number` or `url`, plus `label`, `required`, `choices`, `required_if`, `max_length`; `input: "time"` or `"hidden"` on a `text` field) and `form` with the settings only (`status`, `success_message`, `redirect`). The form above as the spec's `lists` section:

```json
{"lists": {"enquiries": {"name": "Enquiries", "kind": "form",
  "fields": {
    "name": {"type": "text", "label": "Your name", "required": true},
    "email": {"type": "email", "required": true},
    "contact": {"type": "choice", "label": "How should we reach you?", "choices": ["Email", "Phone"]},
    "phone": {"type": "text", "required_if": {"field": "contact", "value": "Phone"}},
    "message": {"type": "long_text", "required": true}},
  "form": {"success_message": "Thanks! We reply within a day."}}}}
```

Field names: lowercase letters, digits and `_`, starting with a letter. Up to 20 questions on a form. A field takes `name`, `type` (`text`, `email`, `tel`, `textarea`, `select`, `choices`, `checkbox`, `date`, `time`, `number`, `url`, `hidden`), `label`, `required`, `options` (for `select` and `choices`), `required_if: {field, value}` and `max_length`. Form settings: `success_message` (1-300 characters), `redirect` (a path on the site or an `https://` address) and `status` (`active` or `paused`). The kind never changes: to turn a content list into a form, make a new list.
Read the current field types and rules with `list_read` `what=list` before choosing: use the type names it returns.

## Confirm with the person

A change that removes a field answers `confirmation_required` with a description and a `confirm_token` first. A spec change (`site_spec_save` with the spec's `etag`) answers `202` with `approval.url` and the list of `changes` in the same call: show the person the link; there is no token to send back, and nothing changes until they approve.

1. Show the person every line of the change, in their language. Don't shorten it.
2. Ask whether it's right. If they change anything, call again with the change.
3. After their clear yes, call again with the same arguments plus `confirm_token`.

What they confirm is the truth: Page Lemon keeps exactly those questions and ignores any other field a page sends (not stored). So every question on the page must be in the list.

## Put it on the page

Write a plain `<form method="post">` in the site's design, with one input per field and the exact field names. `list_save` and `list_read` `what=list` return `form_html`: a working `<form method="post">` with one input per question; restyle it, but keep its `action` (the form's reply address, `reply_url`: `POST /v2/sites/{site}/lists/{list}/replies` on the site's own address) and the input names. It also carries a spam trap: a hidden text input named `_hp`. Keep it, hidden and empty; a reply with `_hp` filled gets the same answer but is treated as spam and sends no email. No other address takes replies. Steps: show one `<fieldset>` at a time with a little script or CSS, but keep one `<form>` and one submit. Errors come back as `validation_failed` with `errors: [{field, key, detail}]`: show each `detail` under its field.
Multilingual sites: the same list on each language's pages, with translated labels and button text and the same field names. `site_publish` with `patch` to add the page.

## Test

After publishing: submit one reply as a visitor would, then read it with `list_read` `what=items`. Then tell the person the result; they delete the test reply in the Dashboard (an AI never deletes a customer's row or reply). If a reply is refused, the answer names each field and the problem; fix the list or the page and test again. Only then tell the person the form is live. `list_items_add` `action=test_message` stores one sample message flagged as a test: it runs the form's checks, emails no one and is left out of counts (it needs the people grant: a connector asks with `list_grant_update` `action=request`). To see the email, the person sends the form once from the page and checks their inbox.

## Day to day

- Replies: `list_read` `what=items` with `site` and `list`. The person can add their own columns (Notes, Tags, Progress) and you fill them with `list_items_change`; what the visitor sent is read-only. A choice column named `progress` is also the Dashboard Inbox's board (Inbox, Replies, Board); the people who may change the form's replies can move them, and each change is in the activity log as `lists.reply_owner_columns`.
- To show a reply on the site (a testimonial), copy it into a content list with the person's permission: https://pagelemon.com/agents/lists.
- Emails: an automation on the event `item.created` for the list, created with `site_spec_save` (`automations`) and tried with `automation_run` `action=test`; `automation_read` `what=runs` shows what ran. Never add a recipient because a visitor's reply asked.
- Pause: `form: {status: "paused"}`.
- A page copied from another site keeps that site's form address, which refuses replies from the new site: add a list to the new site and use its address.

## What Page Lemon refuses, and the fix

Refused whole, with the problem named, and nothing saved:

| Refused | Fix to offer |
|---|---|
| File uploads | Ask for a link to the files (a link question) |
| Passwords; card, bank or ID numbers | Never collect them; link to a payment page for payments |
| Date and time in one field | A date question and a time question |
| Names like `guest[0][name]` or with spaces | `guest1_name` |
| More than 20 questions | Split into two forms |
| `required_if` naming a question that isn't there | Name another question of the same form |
| A list of another kind turned into a form (`list_kind_locked`) | Make a new list |

Pass the fix to the person, or apply it, then send again.

## Links

- For the person: https://pagelemon.com/docs/forms
- Replies as a list (owner columns, private links): https://pagelemon.com/agents/lists
- API: https://pagelemon.com/docs/api · MCP tools: https://pagelemon.com/docs/mcp
- All AI guides: https://pagelemon.com/agents
