Svelte multi-step form
Build a multi-step form in Svelte with no backend. Collect fields across steps in a data object, then post once to Formpaste at the end. Copy the wizard component and add your access key.
How to build it
- Create a form in your Formpaste dashboard and copy its access key.
- Copy the multi-step component below into your app.
- Replace YOUR_ACCESS_KEY_HERE with your access key, then deploy.
Prompt for your AI coding agent
Add a Formpaste multi-step form to my Svelte app. Use a single-file component with a <script> block that collects name, email and message across several steps in a data object with Next and Back buttons, then POSTs once at the end as application/x-www-form-urlencoded (URLSearchParams) to https://api.formpaste.com/submit with a hidden access_key. Do not post on every step and do not add a backend.Or connect the Formpaste MCP server to Claude Code, Codex, Cursor, Claude Desktop, VS Code, or any mcp-remote client. See the setup guide.
Svelte gotchas
A Svelte contact form is a single-file component with bind:value on the fields and an on:submit|preventDefault handler that posts to Formpaste. There is no backend and no API of your own. Put the fetch in the component and you are done.
It is a single-file component
The form lives in a .svelte component with a <script> block. Bind the fields with bind:value or read a FormData off the form element on submit, then post to the Formpaste endpoint. No store or library is required for a simple form.
No API of your own
You do not proxy through your own server. The component posts straight to the Formpaste endpoint, which removes a mailer and a submissions store you would otherwise build.
Handle the response with a reactive status
The endpoint returns JSON (success, message, id). Await the fetch and set a reactive status variable to show your own success or error state, or set a redirect URL in the dashboard and skip the client handling.
Svelte 4 or Svelte 5, both work
The examples use a <script> block with a plain status variable, which works in every Svelte version. On Svelte 5 you can use runes like $state instead, but the same fetch and the same POST are all Formpaste needs.
What to get right
One form, several screens
A multi-step form is a single submission split across steps in the UI. Collect all the fields in client state, then post once at the end.
Route per step is optional
You can give each step its own URL for back-button support, or keep it all on one page with local state. Both post the same final payload.
Post the whole payload once
Do not post on every step. Gather the fields as the user advances and send one request when they finish.
How it works
Three simple steps for form submissions to land in your email inbox.
Create your form, set your form's action URL to Formpaste's endpoint, and add your access key.
Create your form
Sign up, verify your email, and create an access key in your dashboard.
Copy the code
Paste the snippet above into your project. Pick CSS or Tailwind to match your site.
<script lang="ts">
const ENDPOINT = "https://api.formpaste.com/submit";
let step = 0;
let data = { name: "", email: "", message: "" };
async function submit() {
const body = new URLSearchParams({ access_key: "YOUR_ACCESS_KEY_HERE", ...data });
await fetch(ENDPOINT, { method: "POST", body });
}
</script>
<form on:submit|preventDefault={submit}>
{#if step === 0}
<input bind:value={data.name} placeholder="Name" required />
{:else if step === 1}
<input type="email" bind:value={data.email} placeholder="Email" required />
{:else}
<textarea bind:value={data.message} placeholder="Message" />
{/if}
{#if step > 0}<button type="button" on:click={() => step--}>Back</button>{/if}
{#if step < 2}<button type="button" on:click={() => step++}>Next</button>{:else}<button type="submit">Submit</button>{/if}
</form>
Add your access key
Replace the placeholder with your access key to start receiving submissions.
<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY_HERE">Svelte multi-step form FAQ
Paste a form. Get submissions.
Instantly without setting up any backend, servers or databases. 250 submissions/mo free - no credit card.