JavaScript multi-step form
Build a multi-step form with plain JavaScript and no backend. Keep every field in one form, show one fieldset at a time, and post once at the end. Copy the wizard below and add your access key.
How to build it
- Create a form in your Formpaste dashboard and copy its access key.
- Copy the form and script below into your page.
- Replace YOUR_ACCESS_KEY_HERE with your access key, then publish.
Prompt for your AI coding agent
Add a Formpaste multi-step form to my page with vanilla JavaScript. Use one real form containing several fieldsets, a step counter in a let variable, Back and Next buttons that show and hide the fieldsets, and a submit listener that POSTs new URLSearchParams(new FormData(form)) once at the end 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.
JavaScript gotchas
A vanilla JavaScript contact form is plain HTML plus a submit listener. Point the form at Formpaste, add a script that calls preventDefault and posts the FormData with fetch, and the visitor stays on the page. No framework, no build step, no backend.
It is a form plus a listener
Keep the real form markup with an action pointing at the Formpaste endpoint, then add a submit listener that calls preventDefault and posts with fetch. There is no framework and nothing to install, so the same snippet works in a static site, a CMS template, or a hand-written page.
Progressive enhancement is free
Because the markup is a real form with an action, it still submits if your script fails to load or JavaScript is switched off. The listener is an upgrade that keeps the visitor on the page, not a requirement.
Post FormData, not a hand-built object
Build the body with new FormData(form) so every field comes along by name, including the hidden access_key. Wrap it in URLSearchParams for a normal text form, or post the FormData directly when the form has a file input.
Handle the response yourself
The endpoint returns JSON (success, message, id). Await the fetch and show your own success or error message, then call form.reset(). Or set a redirect URL in the dashboard and let the plain form post do the work with no script at all.
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.
<form id="form" action="https://api.formpaste.com/submit" method="POST">
<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY_HERE">
<fieldset data-step><label>Name <input name="name" required></label></fieldset>
<fieldset data-step hidden><label>Email <input type="email" name="email" required></label></fieldset>
<fieldset data-step hidden><label>Message <textarea name="message"></textarea></label></fieldset>
<button type="button" id="back" hidden>Back</button>
<button type="button" id="next">Next</button>
<button type="submit" id="send" hidden>Submit</button>
</form>
<script>
const form = document.getElementById("form");
const steps = form.querySelectorAll("[data-step]");
const back = document.getElementById("back");
const next = document.getElementById("next");
const send = document.getElementById("send");
let step = 0;
function render() {
steps.forEach((s, i) => (s.hidden = i !== step));
back.hidden = step === 0;
next.hidden = step === steps.length - 1;
send.hidden = step !== steps.length - 1;
}
back.addEventListener("click", () => { step--; render(); });
next.addEventListener("click", () => { step++; render(); });
form.addEventListener("submit", async (e) => {
e.preventDefault();
await fetch(form.action, { method: "POST", body: new URLSearchParams(new FormData(form)) });
form.reset();
});
render();
</script>
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">JavaScript 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.