Keep one form element, wrap each step in a fieldset, show one fieldset at a time with a little JavaScript, and submit once at the end. HTML alone cannot move between steps without loading a new page.
Because it is still one form, every field is sent together in a single submission, and any form backend can receive it.
The structure
Each step is a fieldset with a legend. All steps but the first start with the hidden attribute.
<form id="quote" action="https://formtango.com/f/YOUR_FORM_ID" method="POST">
<fieldset data-step><legend>About you</legend> ... <button type="button" data-next>Next</button></fieldset>
<fieldset data-step hidden><legend>Your project</legend> ... <button type="button" data-back>Back</button> <button type="submit">Send</button></fieldset>
</form>
Give the Next and Back buttons type="button". A button inside a form is a submit button by default, and would send the form early.
Moving between steps
The script keeps track of the current step, checks its fields, then swaps which fieldset is hidden.
const steps = Array.from(document.querySelectorAll('#quote fieldset'));
let current = 0;
function show(index) { steps.forEach((step, i) => { step.hidden = i !== index; }); current = index; steps.at(index).querySelector('input, select, textarea')?.focus(); }
function stepIsValid() { return Array.from(steps.at(current).querySelectorAll('input, select, textarea')).every((field) => field.reportValidity()); }
document.querySelectorAll('button').forEach((button) => { if ('next' in button.dataset) button.addEventListener('click', () => { if (stepIsValid()) show(current + 1); }); if ('back' in button.dataset) button.addEventListener('click', () => show(current - 1)); });
reportValidity runs the browser's own checks, such as required and type="email", and shows the usual message on the first field that fails.
Rules that keep it working
- Validate each step before moving on. If a required field is left empty on a hidden step, the browser blocks the final submit and cannot show the visitor why.
- Fields in hidden fieldsets are still sent. Hiding a step does not remove its data.
- Do not use the disabled attribute to hide steps. Disabled fields are not sent.
- Pressing Enter in a text field submits the form. With per-step checks in place that is safe, but test it.
- Move focus to the new step so keyboard and screen reader users know the page changed.
Show progress
Tell people how long the form is: "Step 2 of 3" in text is enough. Put it in the legend or in an element with role="status" so it is announced when it changes.
Receiving it
Nothing special is needed on the receiving side. FormTango stores it as one submission with all the fields, up to 100 fields and 100 KB of text. To stay on the page and show a final "thank you" step, send it with fetch as in how to submit a form with fetch.
Long forms worth splitting include the client intake, rental application and quote request templates.
When not to split a form
Three or four fields do not need steps. Steps help when a form is long enough to look daunting, or when later questions depend on earlier answers.
Common questions
- Can I make a multi-step form with only HTML and CSS?
- Not a dependable one. Showing one step at a time and checking each step before moving on needs a small amount of JavaScript. The form itself stays plain HTML.
- Does a multi-step form send several submissions?
- No, if you build it as one form element. All steps are sent together when the visitor presses the final button.
- Why does my multi-step form refuse to submit?
- Usually a required field on a hidden step is empty. The browser blocks the submit but cannot show the message on a hidden field. Validate each step before letting the visitor move on.
Written by the FormTango team. Facts about other services were read from their own pages on November 22, 2026. Spotted something out of date? Tell us and we will fix it.