A form that works without JavaScript is, in most frameworks, something you work your way towards. Here it is the starting state: a <form method="POST">, the other end in a file next to it, done. It is not a fallback anybody has to keep alive, it is just how the page works. None of the other seven frameworks in this series has a better answer to forms. That is also the problem: when one layer fits this well, the one underneath looks like more of the same.
Why the form is already right here
SvelteKit is built on a compiler. A .svelte file becomes JavaScript at build time that touches the affected DOM nodes directly, rather than building up a tree in the browser first.
The other end is called a form action and lives as +page.server.ts in the same route: an exported actions object with a default entry or, with several forms on one route, with named entries instead; SvelteKit rules out having both side by side. The function reads await request.formData() and ends with data, a fail(400, { ... }), or a redirect(303, '/thanks'), which since SvelteKit 2 no longer needs a throw in front of it. With no client code at all, that is an ordinary form POST which the server answers. There is one condition: the route must not be prerendered - with prerender = true, or on a build using adapter-static, there is no server to answer the POST.
The upgrade costs one import and one attribute: use:enhance from $app/forms intercepts the submit and, with no callback of your own, does what the browser would otherwise have done - reset the form, refetch the load data, follow redirects, hand errors to the nearest error page; update() brings that back into a callback of your own. In Svelte 5 the page reads the result with let { form } = $props().
In this series it has little competition: Astro has to add an adapter first, Hugo has finished running long before anybody clicks, Nuxt sets the route beside the page rather than on it. Next.js comes closest: a Server Action in a Server Component survives a no-JavaScript submit too, but there it depends on whether you are in a Server or a Client Component, and here it depends on nothing. One limit the documentation names: use:enhance only applies to forms with method="POST" that point at an action in +page.server.ts.
What there is no form prop for
At its shortest the action is a handful of lines: request.formData(), your check, a fail() when a field is missing. Past that the framework stops helping.
fail(400, { missing: true }), the form prop, the message next to the field: every error SvelteKit models has somebody sitting there waiting for it. The errors this is about are of another kind: a script that submits four thousand times overnight, a retention period that expired eight weeks ago, or an access request under Art. 15 that arrives as email rather than through your form. None of those cases has an open page with a form prop an answer would fit into. I would not hold that against a UI framework, which is there to model UI failures. This abstraction just happens to go quiet exactly where things get expensive.
It is usually the second form that starts costing. Because the contact page cost so little, the pricing page now gets a callback button, the footer a newsletter line, the careers page an application with a PDF. Each of them needs an action, whether as a named entry in one route or in a route of its own. The twenty lines in it are not the problem; what accumulates sits lower down: a rate limit that counts across all forms rather than per route, filter rules in one place instead of four, a period that runs differently for an application than for a newsletter line. That is not route-level work any more, and it needs an owner.
None of this is SvelteKit-specific; it turns up anywhere a running service accepts forms, and this series’ Next.js piece lists them one by one. What is specific here is the illusion about the price: getting from “my form works without JavaScript” to “the message is delivered, filtered, retained and erasable” takes you into a different discipline rather than a few steps further along the same one. Progressive enhancement says nothing about it; that was never its job.
Wiring it up
The path is shortest without the server file. An absolute URL in action was never anything special for an HTML form, and a .svelte file without a <script> is only markup here.
<!-- no +page.server.ts beside it, no <script> inside it -->
<main>
<h1>Contact</h1>
<form action="https://api.formdall.de/api/v1/f/kx92m4" method="POST">
<label for="name">Name</label>
<input id="name" name="name" required>
<label for="email">Email</label>
<input id="email" name="email" type="email" required>
<label for="message">Message</label>
<textarea id="message" name="message" rows="6"></textarea>
<button type="submit">Submit</button>
</form>
</main>That completes the route: no +page.server.ts and nothing of your own on the client. The submit is a browser POST that arrives before SvelteKit’s bundle has loaded; a redirect follows, and you set its target per form.
The second version puts your own action in front - for server-side validation, for an entry in your database, or because you want use:enhance, which does not fire on a foreign action.
import { fail } from '@sveltejs/kit';
import type { Actions } from './$types';
export const actions = {
default: async ({ request }) => {
const submission = await request.formData();
// your own check runs before the fetch, not after it
const response = await fetch('https://api.formdall.de/api/v1/f/kx92m4', {
method: 'POST',
// this header is the difference between JSON and a redirect
headers: { Accept: 'application/json' },
body: submission,
});
if (!response.ok) {
// no silent failure: this lands in the page's form prop
return fail(response.status, { sent: false });
}
return { sent: true };
},
} satisfies Actions;The two blocks cannot be stacked, because a form has exactly one target. For the second version you delete the action attribute, method="POST" stays, and default picks the POST up. The return value and fail() both land in the form prop, without JavaScript too: SvelteKit then re-renders the page server-side, an {#if form?.sent} in the markup displays it. If you would rather redirect, call redirect(303, '/thanks') at the end - otherwise a reload submits again. Only from here does use:enhance apply, and the page stays put on submit.
Whether you get JSON or a redirect depends on the Accept header of the request. And if you use the MCP server, create_form produces the form and its field schema, and the markup comes out of get_embed.
What you are not building
If a captcha becomes necessary, a self-hosted proof-of-work captcha does the work in the browser. It sets no cookies, tracks nobody and sends nothing to the US. The compiler built you a page whose form works without client JavaScript, and a bought-in widget would be the first thing to undo that.
A submitted message sits with us encrypted, on servers in Germany. We keep a daily rotating hash of the sender’s IP, and server logs are gone after 14 days. Not one line of that stands in your route; +page.server.ts stays as short as it is above. You make those decisions once and never revisit them. In a side project nobody makes them at all.
Access under Art. 15 and erasure under Art. 17 GDPR cost one click per email address. That at least handles the execution of the case from above that had no form prop: the request never arrives through your form in the first place, so it needs no action either. Three forms and 100 submissions a month are free, and no credit card is involved. Your form still works before any JavaScript has loaded; wiring it up does not change that.