sveltejs / sveltejs/kit

Missing field for form doesn't report error

Open
#14,990 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

forms
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

Currently when you create a remote form, you must use the {...form.fields.field.as(...)} syntax when making a form field, but if you forget to add this for one of the required fields, nothing will happen at all. No errors will get thrown, no warnings indicating something is wrong, just nothing will happen on the form submit.

(Also I find it weird that the syntax now required, whereas before it worked fine using the standard name="name" value="value" type="text", but that's not the point of this)

Reproduction

Here is what I managed to make on stack blitz

https://stackblitz.com/edit/sveltejs-kit-template-default-cb8vsuzs?file=src%2Froutes%2F%2Bpage.svelte

Just add the other form field and remove it, and see that nothing happens.

Logs

System Info
OS: macOS 26.0.1
CPU: arm64 Apple M3 Pro
Memory: 97.94 MB / 18.00 GB
Shell: 5.9 - /bin/zsh

Node: 20.19.4
npm: 10.8.2
bun: 1.3.2

Browser: Zen 1.16.4b (Firefox 143.0.4)
Severity

serious, but I can work around it

Additional Information

This is just quite annoying, spent a load of time debugging loads of my forms because of this, also dynamic forms (Record<string, boolean> for example) are also having issues because of this, still trying to see if I can fix that though.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction and trace the remote form submission behavior around the {...form.fields.field.as(...)} syntax. Check what happens when a required field is omitted, then verify that the form reports an error or warning instead of failing silently; consider the noted dynamic-form case if it is covered by the same path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.