Guides

Multi-Step Form on a Static Site: One Endpoint, One POST

Splitting a long form into steps is a front-end job. Here is how to collect every step in the browser and send a single POST to one form endpoint.

· The SimpleForm Team

You have a signup or quote form with twelve fields, and a single long page makes people leave. Splitting it into steps helps, but the moment you do, a question appears: where does each step go? If you send every step to your form backend as it is completed, you get half-filled records, several emails per person, and a monthly submission quota that drains five times faster than you planned.

A multi-step form is one HTML form whose fields are shown a few at a time, with a single request sent after the last step. On a static site, that single request goes to a hosted form endpoint such as SimpleForm, which receives submissions from any HTML form without server code. This article shows the structure, the one browser gotcha that silently breaks it, and how it compares with other approaches.

How does a multi-step form work without a backend?

It works by keeping all steps inside one <form> element and only changing which group of fields is visible. The browser holds every value until the final submit, so no server is involved until the one POST at the end.

Each step is a <fieldset>. The buttons do not submit anything; they toggle the hidden attribute on fieldsets. Only the last step shows the real submit button.

<form id='signup' action='https://simpleform.dev/f/TOKEN' method='POST'>
  <fieldset data-step>
    <legend>Your details</legend>
    <input name='name' required>
    <input name='email' type='email' required>
  </fieldset>
  <fieldset data-step hidden>
    <legend>Your project</legend>
    <select name='budget' required>...</select>
    <textarea name='details' required></textarea>
  </fieldset>
  <button type='button' id='back'>Back</button>
  <button type='button' id='next'>Next</button>
  <button type='submit' id='send' hidden>Send</button>
</form>

Because the action URL points at your endpoint and the method is POST, the form still works as a plain HTML form. The script below only adds the step switching.

How do you move between steps and validate each one?

You validate only the visible step by calling reportValidity() on its fields before you reveal the next one. This is the part most tutorials skip, and it is the cause of the most common bug.

Browsers refuse to submit a form that contains an invalid required field, even if that field is inside a hidden fieldset. The browser cannot focus a hidden control to show the error bubble, so the submit does nothing and the console reports that an invalid form control is not focusable. Checking each step on its own prevents the user from ever reaching the final submit with a hidden invalid field.

const form = document.getElementById('signup');
const steps = [...form.querySelectorAll('[data-step]')];
let i = 0;

function show(n) {
  i = n;
  steps.forEach((s, k) => s.hidden = k !== n);
  document.getElementById('back').hidden = n === 0;
  document.getElementById('next').hidden = n === steps.length - 1;
  document.getElementById('send').hidden = n !== steps.length - 1;
}

document.getElementById('next').addEventListener('click', () => {
  const fields = [...steps[i].querySelectorAll('input, select, textarea')];
  if (fields.every(f => f.reportValidity())) show(i + 1);
});
document.getElementById('back').addEventListener('click', () => show(i - 1));
show(0);

Do not set disabled on fields in hidden steps. A disabled control is left out of the submitted data, so those answers would vanish from the request. Hidden but enabled fields are still included.

How do you send every step in a single POST?

You build a FormData object from the form element and send it once, on the final submit event. FormData(form) collects every enabled field across all fieldsets, whether they are visible or not, as described in the MDN documentation for the FormData interface.

form.addEventListener('submit', async (e) => {
  e.preventDefault();
  const res = await fetch(form.action, {
    method: 'POST',
    headers: { 'Accept': 'application/json' },
    body: new FormData(form),
  });
  const data = await res.json();
  if (data.success) { form.reset(); show(0); }
});

The Accept header asks for a JSON response instead of a redirect, so you can show a confirmation message in place. If you prefer a thank-you page, drop the script's submit handler and set a redirect URL on the form instead.

Here is the full sequence as a short checklist:

  1. Put all steps inside one form element, one fieldset per step.
  2. Set the form action to your endpoint URL and the method to POST.
  3. Hide every fieldset except the first, using the hidden attribute rather than disabled.
  4. On Next, call reportValidity() on the current step's fields and advance only if they all pass.
  5. Show the submit button on the last step only.
  6. On submit, send new FormData(form) in one fetch call and handle the JSON response.

Should you send one POST at the end or one per step?

Send one POST at the end. Posting per step looks safer because it captures partial answers, but it multiplies your submission count, your emails and your cleanup work.

ApproachSubmissions countedEmails per personMain failure mode
One POST at the end11Abandoned forms are never received
One POST per step (5 steps)Up to 5Up to 5Fragments you must merge by hand
Step data in localStorage, one POST at the end11Stale data if the form changes between visits

The numbers matter on a small plan. The SimpleForm Free plan includes 100 submissions per month, so a five-step form that posts at every step allows only 20 completed enquiries before the limit is reached. A single final POST allows 100. Submissions over the limit return a 402 response and are not stored, which is a bad way to learn about the difference.

Rate limiting is a second reason. SimpleForm allows at most 10 submissions per IP address per hour per endpoint, so per-step posting can lock out a user who is simply retrying a long form on a shared office connection.

Where does a hosted form endpoint fit in?

The step logic above is about forty lines of JavaScript you own. The part you do not want to own is everything after the final POST: accepting the request, filtering spam, storing the record, emailing you, and firing a webhook. That is the work SimpleForm does, and the endpoint accepts URL-encoded, multipart and JSON bodies, so the same FormData code works whether or not your steps include a file field. The SimpleForm documentation lists the response codes and the field behaviour in detail.

Two details are worth checking against your plan on the pricing page: file uploads and webhooks are Pro features, with a 5 MB per-file upload limit, while the Free plan covers 3 forms and 7 days of submission history.

What about people who abandon halfway?

With one POST at the end, an abandoned form leaves no trace on your side, and that is the honest trade-off. If you need to follow up with people who gave you an email on step one but never finished, this pattern will not do it.

You have two reasonable options. Put the email address on a first step that submits by itself to a separate endpoint, then run the rest of the flow as a second form. Or accept that partial data is not worth the clutter for a contact or quote form, where an unfinished attempt rarely deserves a reply. The first option does use two endpoints, which is fine because each one represents a real, finished action.

How do you test the finished form?

Test three paths: a normal run through every step, a run where you go back and change an earlier answer, and a run that triggers validation on step two. After each, open your dashboard and confirm that exactly one submission exists with all fields present.

Also test with the keyboard only. Fieldsets with legends are announced correctly by screen readers, and since the Next button is a normal button, Enter on a text input will try to submit the form. If that is not what you want, intercept Enter on non-final steps and call the Next handler instead.

What is the next step?

Create a free endpoint, paste its URL into the action attribute of your multi-step form, and submit one complete test run. You will see a single submission with every step's fields in your dashboard, and you can adjust the step script before real traffic arrives. Create your free SimpleForm endpoint; no credit card is needed on the Free plan.

Frequently asked questions

Yes. Put all steps in one form element, one fieldset per step, and toggle the hidden attribute with a few lines of JavaScript. Send the whole form with a single fetch call using FormData. No framework is required, and the form still posts normally to your endpoint if the script fails to load.

A required field in a hidden step is almost certainly invalid. Browsers block submission when any required control is invalid, but they cannot show an error on a hidden one. Validate each step with reportValidity() before advancing, and remove required from fields that are not meant to be mandatory.

Yes, as long as the fields are not disabled. FormData(form) and a normal form submit both include enabled fields inside hidden fieldsets. Disabled fields are skipped entirely, so use the hidden attribute to hide a step and never the disabled attribute.

Only if you send each step as its own request. Each accepted POST is stored as one submission, so posting five steps separately uses five of your monthly allowance. Collect everything in the browser and send once at the end to count one submission per person.

Yes, if your plan supports uploads. Keep the file input in one of the steps and send the form as FormData, which uses multipart encoding automatically. SimpleForm supports uploads on the Pro plan up to 5 MB per file. Do not set a JSON content type yourself, or the file will be lost.

Ship a working form in five minutes. Point your form's action at a SimpleForm endpoint and submissions land in your inbox and dashboard straight away. Start free or read the docs.

More from the blog