Files
webstudio/docs/university/core-components/form.md
T
Oleg Isonen d4b5b328a4 fix: Resolve reproduced bugs reported on Discord (#6639)
## What this fixes

This PR fixes the bugs from #6633 that we could reproduce:

- Spacing reset no longer triggers canvas Delete; autocomplete selection
is readable in both themes.
- Breakpoint widths save on Enter or blur, without reordering while
someone types. Typed addresses no longer reuse an old history
suggestion.
- Redirect edits use saved project state, and unchanged old redirects do
not block unrelated edits. Client-side links now follow project
redirects, including sites with a custom 404 page. A new publish keeps
polling past an old failed build.
- Editors can open older projects and edit supported Markdown bindings
without changing protected styles or permissions. Older Code Text edits
now survive save, reload, and a later Builder visit; Editors cannot
replace Code Text bindings.
- Form writes are sent once per submission, even when a response fails.
Safe response redirects still work.
- Published pages and Builder Preview restore scroll without unwanted
smooth animation. Preview keeps smooth anchors, repeated anchors,
Back/Forward positions, and page entry animations.
- Large-page selection and paste avoid rerendering unchanged Navigator
rows and rescanning unchanged asset references. Keyboard focus now
follows a moved row when its new parent expands.

## Checklist

- [x] Third deep review: verify the pending legacy Editor permission and
remounted scroll-restoration fixes; simplify the 11 modified files and
deleted hook; demonstrate regression failures and passes.
- [x] Third review: review documentation and fixture impact; run
affected tests, typechecks, lint, formatting, and package boundaries.
- [x] Third review: commit only the pending changes, push to this PR,
review hosted results, and pass required CI.
- [x] Second deep review: check save permissions, redirects, scroll, and
UI state; fix reproduced problems and rerun affected checks.
- [x] Deep-review the full PR, simplify repeated code, fix verified
problems, and rerun affected checks.
- [x] Make project redirects work on client-side link clicks, including
sites with a custom 404 page; add a failing regression test, verify both
runtimes, and review documentation impact.
- [x] Reproduce the changed behaviors; show regression tests fail and
pass.
- [x] Check Editor, Preview, Navigator, Form, redirect, publish, and
theme behavior in focused tests and browser workflows.
- [x] Review the full diff for correctness, duplication, and needless
complexity. Simplify redirect validation and strengthen the cross-page
anchor test.
- [x] Inspect light and dark autocomplete screenshots and approve the
one intended new visual story.
- [x] Review documentation impact. Update the Form guide for uncertain
delivery responses; other changes restore expected behavior.
- [x] Complete independent review, package typechecks, lint, boundaries,
generated API/docs checks, and fixture build.
- [x] Run the approved full agent evaluation suite. Eight of nine
scenarios passed; the remaining evaluator and baseline limits are below.
- [x] Pass required CI on the earlier review commits; the third-review
head is tracked above.

## Implementation notes

Preview uses one navigation request between the Builder and canvas. It
records scroll before a page changes and restores it before entry
animations. Router keys are observed only in Preview. This adds 211 net
production lines because shorter approaches failed repeated anchors,
delayed navigation, and returns from Design. Navigator and focus changes
add 87 lines; the shared published-page hook adds 40. The earlier
cleanup added 427 net production lines; this review adds 43 net non-test
lines.

Legacy document bindings are normalized when loading a snapshot and
checking Editor capabilities. Older Code Text content is normalized on
reads without saving; the first edit removes its stale property in the
same version-checked save. Direct Editor patches cannot add or replace
Code Text expressions. Editor reads do not migrate the database.
Read-only bindings and template styles remain protected. No schema,
package, icon, or product copy changes are included.

The visual harness has an opt-in focus setting for the autocomplete
story. Its default blur behavior is unchanged. The test now mounts
scroll restoration after the route content, matching the production
Body; it checks an anchor found only on the destination page.

## Review follow-up

The review found two reproducible bugs. Older Code Text edited by an
Editor could be overwritten by the legacy `code` property on a later
Builder visit. A Navigator row moved into a collapsed parent could lose
keyboard focus. Both are fixed with regression tests. The review also
removed one duplicate parser, a repeated autocomplete color check, and
an unnecessary prop scan on page-only saves. The Remix scroll test now
mounts restoration in the same order as production.

The legacy Code Text test covers literal and expression content, direct
patch permissions, save retries, undo/redo, and Editor → reload →
Builder → reload. The local end-to-end test passed. The other focused
tests, affected package typechecks, lint, formatting, package
boundaries, generated API/docs checks, and fixture build passed. A
fixture sync picked up unrelated remote sitemap data; that generated
drift was removed from this PR. The full agent evaluation was not rerun
for this follow-up.

## Client-side redirects

The root loader now checks redirects when the path changes, even when a
custom 404 route matches. A generated yes/no flag in its own file avoids
extra navigation requests on projects without redirects; the browser
does not receive the redirect list. Projects with redirects pay for a
root-loader check on each path change. Query-only navigation keeps the
router's normal revalidation behavior. The new test reproduced the
custom-404 failure before the fix and passes afterward. Both React
Router and Remix templates, generated fixtures, typechecks, production
builds, and the redirect-settings browser test pass. Existing redirect
docs already describe this expected behavior, so no docs change is
needed.

## Performance

With 3,000 styled elements, median selection fell from 986 ms to 413 ms
in a controlled local browser test. Full page paste including save
measured 3.4 seconds afterward; the earlier run varied from 4 to 15
seconds, so that is not a reliable whole-paste speed multiplier.

Skipping an unchanged asset-reference rewrite reduced that isolated step
from 1,500 ms to 7 ms with 200 assets, 3,000 properties, and 12,000
styles. The browser still downloads and syncs project data, traverses
the tree, validates and imports assets, inserts content, renders, and
saves. Cross-project imports can still transfer assets.

## Second review follow-up

Changing a breakpoint from Min width to Max width (or back) now saves
the type and width together. A mixed Builder/Editor save now checks each
Editor change against the Builder changes before it, including older
Code Text bindings and changes to Content block boundaries. If an
earlier save fails, later entries do not run against a state that was
never saved.

A full page reload now restores its saved scroll position without
animating through the page. Client navigation still uses the existing
hook. The two early scripts add no network request; they run next to the
router's restore script, then restore the page's smooth-scroll setting.
A nonce on Body is passed to all three scripts. Rebuilding Editor
permissions costs a fresh scan only for mixed-permission batches;
all-Builder batches keep the fast path.

Focused checks passed: 40 patch authorization/save tests, five
breakpoint browser tests, two early-scroll browser tests, 12 router
navigation browser tests, four package typechecks, lint, formatting, and
diff checks. The real SSR test also passed with delayed hydration and a
nonce-only script policy, with no scroll animation or hydration warning.
The full agent evaluation was not rerun; the earlier 8/9 result and its
known evaluator limit remain unchanged. Documentation impact was
reviewed again; these changes restore expected behavior and need no new
user guide. On commit `b61c3aaf07`, the main workflow, all ten Builder
browser shards, lint, submodule checks, and the approved visual rerun
passed. The first visual comparison still records the already reviewed
autocomplete difference; its approval rerun passed.

## Third review follow-up

The pending changes close two Editor permission gaps. IDs hidden by
read-time Code Text normalization remain reserved, so an Editor cannot
reuse one to overwrite a protected saved prop. New Code Text accepts
literal content but cannot introduce expressions. A Builder can
deliberately replace a legacy prop and leave the replacement editable.

Scroll preparation now runs after the destination DOM is inserted and
before the router restores scroll. This preserves smooth anchors when
restoration remounts with a page. The shared component replaces the
separate hook. The navigation test now covers all six cases with and
without remounting, removing the duplicate remount setup. The patch adds
51 net non-test lines, close to the 50-line estimate; the extra state
records hidden saved IDs, and the extra component orders the three
layout effects.

Regression checks reproduced the hidden-ID overwrite, new expression
insertion, copied-prop ID reuse, and instant remounted anchor before the
fixes. They pass with the fixes. Local checks passed: all 2,677
project-build tests, 48 patch tests, the three SDK package suites
(including 219 SDK React tests with one existing skip and 46 React
Router tests), all five affected package typechecks, lint, formatting,
package boundaries, generated API/docs checks, and fixture regeneration.
Two Form tests timed out in the first parallel SDK run; both passed in
isolation, and the complete SDK suite passed with one worker.

Fixture regeneration used the existing local snapshots and downloaded
required assets; it produced no tracked fixture changes. Remote fixture
synchronization was not rerun. The Code Text, Content Block, share-link,
and Link docs already describe the intended behavior, so no docs change
is needed. The full agent evaluation was not rerun; its earlier 8/9
result and baseline limits still apply. A separate local model review
was unavailable. Hosted automatic code and security reviews completed on
`472dbc103e`; neither posted findings, and there are no unresolved
review threads.

Committed and pushed as `472dbc103e`. The [main
workflow](https://github.com/webstudio-is/webstudio/actions/runs/42071262279)
passed, including all ten Builder end-to-end shards, both
package/CLI/core/app environments, typechecks, lint, generated checks,
migrations, and size checks. Development preview fixture checks passed
on Ubuntu and Windows. The [visual approval
rerun](https://github.com/webstudio-is/webstudio/actions/runs/42071810156)
passed. Its initial run flagged only the previously approved
autocomplete story; all 267 stories were compared, with no other
differences. The story was unchanged by this commit, so its existing
approval was reapplied. The worktree is clean, and the remote branch
matches the local commit. The excluded issues and other worktrees were
not changed. No production deployment was initiated.

## Remaining follow-ups

- #6645: The measured asset-remapping slowdown is fixed here, but the
reported 30-second end-to-end paste remains unverified. Closed as not
planned until the reporter shares a reproducer.
- #6646: MCP can now inspect Global root defaults, but the reporter's
original AI run remains unverified.
- #5379: The broader proposal to remove the root grid remains open; this
PR fixes the narrower overflow bug #6070.
- #6644 was closed as not planned after local tests passed. The bad SSL
report and unrelated feature requests are outside this PR.

No shipped-fix announcement or production release is included.

## Verification

The previous commit passed the main workflow, all ten browser shards,
lint, submodule checks, and the approved visual rerun. The review commit
passed the main workflow, all ten Builder browser shards, lint,
submodule checks, and the visual-approval run. The initial visual check
flagged the already-reviewed new autocomplete story; the approval run
passed without a visual code change. An earlier browser run caught a
generated-file format change; the follow-up kept that format intact and
passed the same test. The full agent evaluation suite was not rerun for
this redirect follow-up; Oleg asked to run it once all remaining work is
fixed.

Local: 2,675 project-build tests, 1,522 Builder core tests (one existing
skip), 40 React Router tests, eight affected-package typechecks, lint,
format, boundaries, generated API/docs checks, and fixture build passed.
The earlier head also passed the Builder app, SDK, component, CLI,
Editor/Preview/Navigator browser tests. On the final commit, all ten
hosted browser groups, package and app checks, fixtures, migrations, and
the approved visual run passed. The first Builder core job hit its
seven-minute CI limit without an assertion failure; its single-job retry
passed. The first visual job listed the already reviewed new
autocomplete story; its approval rerun passed.

The complete Sol/high agent suite finished with **8/9 scenarios
passing**. The remaining native Form authoring evaluator rejects a plain
HTML action URL as though it were a managed Webstudio Action. That
fixture did not test actual browser submission, so no runtime claim is
made. The comparison gate remains non-green: five baselines use another
model and four fixtures have no accepted baseline. No baseline or
validator was changed to hide this.

The MCP Form result fix for #6640 is now included below. A fast redirect
no longer leaves MCP without the Form result. The older local source
failure helped reproduce this case.

Closes #6633
Closes #6640
Closes #2439
Closes #6642
Ref #6645
Closes #6641
Closes #6643
Ref #6644
Ref #6646
Closes #6647
Ref #5379
Closes #6070
Ref #980
Ref #4309
Ref #6573


### Consolidation of follow-up fixes

- [x] Include and verify the Resource body, expression Tab, and 404
starter fixes from #6649, #6651, and #6650.
- [x] Include and verify the root overflow, Navigator lag, and
asset-paste fixes from #6652, #6653, and #6654.
- [x] Include the Global root MCP inspection fix from #6655, with its
discoverable example.
- [x] Review `docs/` and fixture impact for the combined changes.
- [x] Pass final CI on the combined branch.
- [x] Close the superseded PRs after their changes were verified here.

The 30-second end-to-end paste report is closed in #6645 until the
reporter shares a reproducer. The original MCP agent outcome in #6646 is
still unverified. Oleg approved keeping the public MCP example. The fix
from #6656 is now included in this PR.

The combined branch passed 236 focused tests, Builder/SDK/project-build
typechecks, lint, formatting, package boundaries, generated API and
MCP-doc checks, and the fixture pipeline. The fixture sync fetched an
unrelated live-project change; rebuilding from the checked-in data
restored a clean worktree. All nine agent evaluation scenarios passed,
but the comparison gate remains non-green because saved baselines are
missing or use a different model. The [main
workflow](https://github.com/webstudio-is/webstudio/actions/runs/42090765144)
passed all jobs, including ten Builder browser shards. The [approved
visual
rerun](https://github.com/webstudio-is/webstudio/actions/runs/42091462930)
passed; its first run flagged only the already-reviewed new autocomplete
story. PRs #6649–#6655 were closed as superseded, with their changes
retained here.

### Final MCP Form consolidation

- [x] Include the tested MCP Form redirect fix from #6656 without
changing submission count or result limits.
- [x] Run focused Vision/CLI tests and review the combined diff.
- [x] Review `docs/` and fixture impact for this fix. The change is
limited to Vision's Form result capture and tests; no docs or fixture
update is needed.
- [x] Pass CI on the new combined head.
- [x] Close #6656 once its change is verified here.

The user clarified that all bug-fix PRs from this work should be one PR.
The MCP Form redirect fix belongs here too. The two Vision files match
#6656 exactly. All 121 Vision tests, Vision and CLI typechecks,
formatting, and the 59 focused Form capture tests passed. In the full
local CLI run, 1,304 tests passed and two unrelated tests failed under
parallel load; both passed in a single-worker rerun. The [main CI
run](https://github.com/webstudio-is/webstudio/actions/runs/42093902295)
passed, including all ten Builder browser shards. The [approved visual
run](https://github.com/webstudio-is/webstudio/actions/runs/42095225165)
passed. The initial visual run flagged only the previously approved
autocomplete story. #6656 is closed as superseded by this PR. No
production release was started.


### Large-project Navigator follow-up

- [x] Import the provided large project into an isolated local Builder
and measure selection-to-Style-Panel time with the tree expanded.
- [x] Measure Navigator scrolling and confirm whether the current scroll
path is native.
- [x] Fix only the reproduced bottlenecks, with regression checks that
fail before the change and pass afterward.
- [x] Review `docs/` and fixture impact; run focused tests, typecheck,
lint, and browser checks.
- [x] Open the fixed local Builder for Oleg's manual check, then pass
final CI.

This follows the original large-page Navigator report in #6641. The
separate 30-second paste report #6645 remains closed because it
describes a different action and has no paste reproduction yet.

The imported project has about 1,244 visible Navigator rows on the
measured page. With the tree expanded, selection took roughly 0.9–2.2
seconds before this change and roughly 0.5–1.3 seconds afterward in
local browser runs. Browser style recalculation fell from about 0.4–1.0
seconds to about 0.1–0.3 seconds per selection; times vary by run. The
Navigator now uses native scrolling and lets the browser skip layout for
rows off-screen. Horizontal wheel scrolling was restored and checked
after Oleg spotted a regression. A focused regression test failed before
the change and passes now. The Navigator tests, Builder typecheck, lint,
formatting, diff check, and local browser selection/vertical/horizontal
scrolling passed. The `docs/` guide and fixtures need no change because
the interaction stays the same. Oleg reports that performance feels good
in the local Builder. The [main CI
run](https://github.com/webstudio-is/webstudio/actions/runs/42103807815)
passed, including all ten Builder browser shards. One unrelated
design-system browser test timed out on the first run and passed on
retry. The [visual approval
run](https://github.com/webstudio-is/webstudio/actions/runs/42105155951)
passed after review of tiny Navigator text-pixel differences and the
previously approved autocomplete story. No production release was
started.


### Final review: Navigator drop marker

- [x] Reproduce the clipped marker with a focused regression test.
- [x] Keep the marker visible without losing off-screen-row performance.
- [x] Review `docs/` and fixture impact, run focused tests, typecheck,
lint, formatting, and browser checks.
- [x] Push this fix to the same PR and pass required CI.

The regression test failed before the fix (`auto` instead of `visible`)
and passed afterward. A sortable row now marks when it has a drop
target; only that row skips the off-screen containment rule, so its
marker can cross the row edge. Other rows retain containment. Navigator
and tree browser tests, both typechecks, lint, formatting, and diff
checks passed locally. The Navigator guide still describes the same
drag-and-drop behavior; no docs or fixture update is needed. This adds
two net non-test lines, matching the small-change estimate.


The [main CI
run](https://github.com/webstudio-is/webstudio/actions/runs/42109032555)
passed all 23 jobs. Two MCP Form browser shards first returned an
unexpected `unknown` form status, then passed on rerun without a code
change. The [visual approval
run](https://github.com/webstudio-is/webstudio/actions/runs/42109658799)
also passed. No production release was started.

### Drop marker color follow-up

- [x] Remove the white outline and white fill so the marker is blue with
a transparent center in both themes.
- [x] Add a browser regression check that fails before the fix and
passes after it.
- [x] Review `docs/` and fixture impact; run focused tests, typecheck,
lint, and formatting.
- [x] Push to this PR and pass required CI.

The old styles failed the new light/dark browser test because the line
had a white outline. After removing the outline and the white circle
backing, all 20 focused indicator/tree tests pass. Design-system
typecheck, lint, formatting, and diff checks pass. The Navigator guide
describes behavior, not marker colors, so docs need no update. No
fixture input or output changes.

The [main CI
run](https://github.com/webstudio-is/webstudio/actions/runs/42115118863)
passed all 23 jobs. Three MCP Form browser shards first returned an
unexpected `unknown` status and passed on rerun without a code change.
The [approved visual
run](https://github.com/webstudio-is/webstudio/actions/runs/42115696559)
passed after GitHub cancelled its first attempt. The intentional
indicator difference and the two previously reviewed Navigator text
differences were approved. No production release was started.

### MCP Form status follow-up

- [x] Review the old first-attempt failures and compare the new
first-pass Form CI results; the old reports did not expose which layer
failed.
- [x] Stop masking pre-submission browser errors as uncertain Form
outcomes; confirm the regression test fails before and passes after.
- [x] Review `docs/` and fixture impact; run focused tests and package
checks.
- [x] Push the fix to this PR and pass required CI.

The CLI had returned `unknown` for every browser error, including
startup failures before any Form submission. It now lets those errors
surface. The browser observer still returns `unknown` if a submission
may have happened, and neither path retries it. This removes 8 net
production lines. The regression test failed before the fix and passes
afterward. All 50 CLI preview tests and 59 Vision browser tests passed,
as did CLI/Vision typechecks, lint, formatting, and the diff check. No
docs or fixtures changed. The approved full agent evaluation ran: 8/9
scenarios passed; the existing managed-Form authoring `contactPage`
check failed, while the Form runtime scenario passed. The comparison
gate is also non-green because saved baselines are missing or
incompatible. Commit: `a2ff0822ad`. The intermittent CI cause still
needs a first-attempt check.

[Main CI on the new
head](https://github.com/webstudio-is/webstudio/actions/runs/42123770480)
passed all jobs, including all ten Builder browser shards on their first
attempt. The Form-heavy shards 1, 5, 6, 9, and 10 passed. The [approved
visual
run](https://github.com/webstudio-is/webstudio/actions/runs/42124446769)
passed; its initial run showed only the four previously reviewed UI
differences, none from this CLI-only patch. The older flaky `unknown`
results cannot be attributed to startup versus post-dispatch observation
from their logs, so this fix addresses a proven masking bug and adds
regression coverage, but does not prove every possible intermittent
observer failure is gone. No production release was started.
2026-11-06 00:19:21 +01:00

20 KiB
Raw Blame History

description
description
Send data, files, and emails, or build search and filters without reloading the page.

Form

Form is a custom Webstudio component for collecting information without reloading the page. Use it to:

  • Send data and files to an API.
  • Send email notifications and visitor confirmations.
  • Build search and filter forms that update URL query parameters.

A single submission can do several things at once. For example, it can email your team, confirm receipt to the visitor, and send the submitted data to another service.

You can test all of this in Preview without publishing.

For a basic HTML form with native browser behavior, insert an Element and set its tag to form.

Start with a working contact form

Insert Form (Beta) from Components > Forms. On Webstudio Cloud, the default form is ready to use. It includes:

  • Name, email, subject, and message fields.
  • An optional file attachment.
  • Email to owner, which sends the submitted information and page URL to your project recipients.
  • Email to visitor, which sends a confirmation to the submitted email address.
  • Editable success and error messages.
  • An editable message while the Form is submitting.

If you haven’t configured project recipients, the owner notification goes to the account holder.

Open Preview and submit with an email address you control to try it. These defaults are a starting point: you can change the fields, customize the emails, or replace the actions entirely.

Collect the information you need

Add fields inside the Form from Components > Forms. Each field needs a Name, which identifies its value when the form is submitted.

Forms section in the Components panel, with Form (Beta), Button, Input Label, Text Input, File Input, Text Area, Select, Radio, and Checkbox.

For example, a field named subject becomes available in bindings as formData.subject. Its visible label can be different.

Fields can share a Name to collect multiple values, such as a group of checkboxes.

See the individual component guides for field settings:

Send to several destinations

Actions define what happens when someone submits the Form. Each action uses a Resource, which contains the destination and its settings.

You can select up to 10 REST, GraphQL, or Email Resources.

Select the Form and open Settings > Properties & attributes > Action:

  • Click + to choose a Resource.
  • Click an existing action to edit its Resource.
  • Drag actions to change their order.
  • Remove an action to stop using it on this Form. The Resource itself remains available.
Form Action settings with the plus button, Email to owner and Email to visitor actions, and the Success redirect control below them.

If the list is empty, create a Resource in Variables first. You can select each Resource once.

Actions run in parallel. Reordering them changes the order of their results, not the order in which they run. One selected action cannot use another action’s response.

Use submitted values

Create a Resource on the Form when it needs submitted values. You can then bind fields into its settings:

"Contact form: " + (formData.subject ?? "New message")

Resources on ancestors or the global root can also be selected as actions, but they cannot bind this Form’s local variables.

Send to an API

Choose a Resource type that matches your service:

  • REST: configure the URL, headers, search parameters, body, and format.
  • GraphQL: configure the URL, headers, query or mutation, and variables.

When used as Form actions, HTTP Resources send POST requests, regardless of their saved Method.

If an HTTP Resource has no configured body, the Form sends its submitted fields. This also works for Resources on ancestors or the global root. Set a custom body when you want to choose or transform the fields yourself. GraphQL uses its configured query and variables.

For REST Resources, Format controls how the body is sent:

Format What it sends
auto Plain text for text values, JSON for objects and arrays, or multipart form data when the body contains file fields.
application/json An object or array as JSON.
multipart/form-data Fields and files as form data.

Choose the format your API expects. Uploaded files need multipart form data; they cannot be sent as JSON.

See Variables for more about Resource settings and bindings.

Customize email notifications

Email Resources can notify your team, confirm receipt to a visitor, or send different messages to different recipients. The default Form includes two emails, but you can edit or remove either one.

Email to owner Resource configuration with project recipients, an empty Reply to field, bound Subject and Body fields, and Attach submitted files selected.

Choose recipients

Recipients option Who receives the email
Project recipients (or owner) Addresses from project settings, or the account holder if that list is empty.
Custom recipients Addresses entered or bound on this Resource.
Visitor email field The address submitted through the Form’s selected email input.

Use Name <address> to include a recipient’s name, such as John <john@example.com>. Separate multiple custom recipients with commas.

For a visitor confirmation, create the Email Resource on the Form. Its email input must have a fixed Name and a Type of email to appear in the field selector. The submitted value must contain one valid email address.

Email to visitor Resource with Visitor email field selected, the email input chosen, a confirmation message, and Do not attach files selected.

Set Reply to

Reply to determines where replies go. It accepts one address, optionally with a name, and supports bindings.

For an owner notification, you could use the visitor’s details so your team can reply directly:

`${formData.name} <${formData.email}>`

Leave Reply to empty on the Resource to use the value from project settings.

The name in Reply to also identifies your organization in the default visitor confirmation. It appears in the subject and at the end of the message. Without a name, the default uses “Site Owner.”

Reply to does not change the sending email address used by Webstudio’s email service.

Write the subject and message

Both Subject and Body support bindings. Use submitted fields to personalize the message, or browserInfo.pageUrl to include the page it came from.

To include all submitted fields, insert formData into the body:

`Message from ${formData.name}

${formData}`

Webstudio turns the object into readable field names and values. Adding another named field then includes it automatically. Files appear as filenames; attaching the files is a separate setting.

Automatic formatting excludes password inputs and Webstudio’s internal fields. If an input’s Name or Type uses a binding, the automatic field list is omitted. Use explicit field bindings in that case.

The default visitor message thanks the visitor, confirms receipt, and ends with the name from Reply to. You can replace its subject and body with your own text.

Email bindings can use submitted fields and other available Variables, but cannot use another Resource’s response.

Share defaults across forms

Set recipients and Reply to under Project settings > Emails.

  • Choose Project recipients on a Resource to use the shared recipient list.
  • Leave its Reply to empty to inherit the project value.
  • Set either field on the Resource to override that default.

Subject and body belong to each Email Resource.

See project email settings.

Send files

Add a File Input inside the Form and give it a Name. Use Required, Accept, and Multiple to configure the picker.

Accept helps visitors choose the right files. The receiving server must still validate their types.

Each action controls what happens to uploaded files:

  • Email: choose Attach submitted files or Do not attach files.
  • HTTP API: use multipart form data. The automatic format selects it when the body contains files.

The default owner email attaches files. The default visitor confirmation does not. An optional file input left empty sends no file.

See Input for field settings and Limits and hosting below for upload limits.

Build search and filter forms

Remove all actions to switch the Form to Navigation mode.

Submitting now puts the named field values into the current page’s URL without a full reload. For example, submitting chairs through a field named query on /products produces:

/products?query=chairs

A page Resource can use that value through a binding:

system.search.query

Bind it to the Resource’s search parameter to load matching results. Add more fields for filters such as category or price.

Submission replaces the current query string. Include any parameters you want to keep as fields; hidden inputs work for this. Fields sharing a Name produce repeated query parameters.

Navigation mode does not use Success redirect. Use Resource actions when you need to upload files.

Choose what happens after submission

The default Form contains four containers:

  • Form content holds the fields.
  • Progress shows a message while the Form is submitting.
  • Success message appears after success.
  • Error message appears after failure.

Their Show bindings use formProgress.status for Progress and formState for the other containers. By default, the fields remain visible while submitting and after a failure. Success hides the fields and shows the success message.

Select the message containers in Navigator to design them. To edit the Progress text, select its first Span child. Progress shows “Submitting…” and, when the browser measures the request, a short byte summary such as “1.2 MB / 3 MB”. The message stays visible while actions finish.

Keep the fields visible

To keep the Form visible after success, select Form content and change its Show binding to an always-visible value.

A successful submission without a redirect resets fields to their default values. The default template has empty values, so visitors see an empty form again. You can show the success message alongside it.

On published dynamic sites, a successful submission also refreshes the current page’s Resources without reloading the page.

Redirect to another page

Set Success redirect below the actions to send visitors to a thank-you page or another URL after success.

This setting is available when the Form has actions.

Handle failures

All actions except visitor confirmation must succeed for the Form to show success. A failed visitor confirmation is recorded in errors, but does not make an otherwise successful submission fail.

Actions can succeed or fail independently. Your team might receive an email even when an API request fails. Check the individual results before submitting again.

Emails and API write requests are not automatically resent when the result is uncertain, to avoid duplicates. A failed response can arrive after the service has saved the submission. Check the receiving service before submitting again.

Use Form variables

The default Form provides these Variables on the Form and its children:

Form Variables list showing formData, browserInfo, Email to owner, Email to visitor, formState, results, errors, and system, with dynamic and static badges.

The screenshot predates formProgress; newly inserted Forms include it as shown below.

Variable What it contains
formData Submitted values, keyed by field Name.
browserInfo The page URL and available visitor details, such as browser, language, referrer, and IP address.
formState initial, success, or error.
formProgress Submission status, measured request bytes, and selected-file details.
results Action responses in order, including Resource name, HTTP status, and response body.
errors Failed action details, including available status, response body, and error message.

Use formData and browserInfo to customize messages and requests. Use formProgress.status to show when a request is pending, formState for its outcome, and results and errors for action feedback.

formProgress.status is pending while files upload and actions run. It returns to idle when the submission finishes or is canceled. formProgress.loaded and formProgress.total start at 0. They count bytes sent for the complete request, including fields and multipart encoding, when the browser can measure them. A total of 0 means the total is not yet known. Use formProgress.loaded / formProgress.total for a percentage only when total is greater than zero.

formProgress.files lists each selected file with id, fieldName, name, size (bytes), and type (MIME type). The browser does not provide reliable transferred byte counts for individual files in this request, so only the whole-request measurements appear in formProgress.loaded and formProgress.total.

When adding a binding inside a Form, autocomplete shows one example file so you can discover these fields. The example is only a suggestion in the editor; the actual files value remains empty until a submission includes files.

The default formProgress variable is added to newly inserted Forms. Existing Forms keep their current formState bindings and submission message. Navigation mode changes the URL without a managed submission, so it leaves formProgress idle with no files.

Create action Resources on the Form itself when they need these local bindings.

Available visitor details depend on the host and request. Referrer query parameters are removed, and an IP address is only included when the host provides a trusted source. browserInfo does not expose cookies, authorization, or raw request headers.

Test without publishing

Preview lets you test the current draft, including emails, API requests, attachments, and redirects.

  1. Open Preview and submit the Form.
  2. Check the visible feedback and expected emails or API results.
  3. Return to design mode and open an action’s Resource.

Preview sends real emails and makes real requests. Use addresses you control and test destinations.

The Resource inspector shows:

  • Request: what was sent.
  • Response: the returned status, headers, and body, where available.
  • Diagnostics: additional execution details, when available.

Sensitive values are hidden, large output is limited, and files appear as metadata rather than their full contents.

Loading an Email Resource’s request preview does not send an email. Submit the Form in Preview to test delivery and capture its response.

Once the Form works as expected, publish it to update the site. Later Builder changes need to be published again.

Limits and hosting

Files and message sizes

Limits count the whole request or message, not each file separately.

Limit What it includes
25 MiB per published Form submission The complete incoming multipart request: fields, files, and multipart encoding.
4.5 MB per Preview Form submission The complete request: fields, files, and multipart encoding. Leave room for fields and encoding when choosing file sizes.
25 MiB per outbound HTTP Resource body Webstudio's body-size check for a Form action. The destination or its network path may allow less.
1 MiB per HTTP Resource response The complete response after decompression, for actions and their HTTP dependencies. Request fewer fields or use pagination if it exceeds the limit.
32 attachments per email All files attached to that email.
7 MiB per email-service request The complete JSON request, including email text, attachment data encoded as Base64, and other fields.

Multipart encoding adds bytes around each uploaded file and field. Base64 encoding makes attachments larger in the email-service request. Leave room for both when choosing file sizes.

Cloudflare's email limits list 5 MiB for a complete email, or 25 MiB for verified destination addresses. Those are provider limits, not guaranteed Form allowances: Webstudio's 7 MiB JSON limit and the incoming Form limit can stop a submission first. The final email includes its own encoding and headers.

Sending limits

Webstudio Cloud allows up to five team-recipient deliveries per submission, plus one visitor confirmation Resource. Duplicate addresses count as separate deliveries.

An approximate limit of 50 recipient deliveries per project, per Cloudflare location, per minute also applies. This is not a guaranteed cutoff. Preview and published sites have separate limits. Provider account limits may apply too.

If an email fails, check its response for the reported reason. See Cloudflare’s email error reference.

Hosting

Resource actions need a server. Webstudio Cloud provides this; a static export cannot run them.

Self-hosted sites need a supported server setup and an email integration to send Email Resources. See self-hosting.

For a Docker or other Node export, an HTTP Resource action can send to a public API on a sibling subdomain, such as cms.example.com from site.example.com. The export blocks known site hostnames and rejects marked requests that return through another alias. Rebuild and redeploy the export with an updated CLI; installing a newer SDK in an existing container does not change the generated destination policy.