LFW

Blog · Getting forms right

Submitting Without Losing the Page

How to submit a form without reloading the page and without losing the visitor's work: the four states a submit button owes the visitor, why typed text must survive every failure, and how to make success heard by screen readers as well as seen.

A reload can erase what the visitor typed

With a traditional form, the visitor presses the button, the browser throws away the page they were on, and a new page arrives saying what happened. When everything works, that's fine. When something fails (a validation error, a server problem, a dropped connection), the visitor gets whatever page the server sends back, and in too many setups that page arrives with every field empty. Ten minutes of careful writing is gone, replaced by a sentence about an invalid phone number.

That's the real reason to submit without leaving the page. When the page stays, the visitor's work stays with it. The paragraphs they typed, the options they chose, and their place on the page all survive whatever happens next.

The goal is certainty

Submitting in place takes something away, though. Loading a new page, for all its faults, was clear evidence that something happened. Remove it without putting anything in its place and you get the worst version of the form. The visitor clicks, nothing on the screen changes, and they're left staring at it. Did it send? They click again. Now you may have two submissions, or none, and they still don't know.

So the real question is whether every stage of the submission is obvious to the visitor. A form that submits in place has to show on screen what loading a new page used to show. That is the actual work.

The four states a submit button owes the visitor

Idle: the button invites the click. Working: the moment the click lands, the button shows it. It disables itself so a nervous second click can't create a duplicate, and its text changes to something like 'Sending…' so the visitor sees it right where they are already looking.

Failure: a plain-language message appears near the problem, and every field still holds what the visitor typed. Success: the form is replaced by a confirmation that clearly ends the exchange, saying what was received and what happens next. A form that quietly clears itself leaves the visitor to guess whether it worked.

Spend the most design time on failure, because it decides whether the visitor tries again. If the form keeps their words, a failure is a small delay: they press the button again and move on. If the form loses them, that is often the end of the conversation. Very few people will rewrite a long message from memory for a form that just threw away the first draft.

Success has an accessibility catch that's easy to miss. If the confirmation simply appears on the page, a visitor using a screen reader may hear nothing at all. The confirmation has to be announced as well as shown, either by moving focus to it or by marking that area of the page so assistive technology reads the change aloud. For public-sector sites this is the same standard as the rest of the page: everyone must be able to perceive a change of state.

When the script fails, the form must not

Submitting in place depends on JavaScript, the least dependable layer of any page. Strict corporate networks block scripts, an unrelated error elsewhere on the page can break them, and on a bad connection they may never arrive. If your form only works when its script works, it fails silently, and it fails for the visitors least able to figure out why.

Build a real form underneath. It should submit the traditional way on its own, with the in-page behavior added on top when the script loads and runs. If the script works, visitors get the calm version with no reload. If it doesn't, the form still submits and a plain confirmation page still answers. Nobody is left pressing a button that does nothing.

Treat the network the same way. When a submission times out partway, the form can't know whether the message arrived, so it should say so plainly, keep the visitor's text, and offer to try again. Organizations that show 'success' when the real answer is 'unknown' end up apologizing for messages they never received.

The submit button is a promise

Everything above comes down to one rule. Once someone presses submit, they've done their part, and every risk after that belongs to the form. Protect their work, tell them what happened, and never let a failure cost them more than one more click. Visitors won't notice any of this when it works. They'll just trust the form, and that feeling is how most people judge an institution's competence online.

When a submission does fail, the wording of the message matters as much as the mechanics. That's the next part of this series: error messages that actually help, instead of saying 'invalid' and leaving the visitor to guess what a valid life would look like.

Keep reading

September 20, 2026 4 minutes

What a Stranger Learns About Your Site in One Minute

Everything in this article is public. It is what a curious visitor, a vendor sizing you up, a journalist, or a scanner run by someone less friendly can read about your website in about a minute. The free audit runs those same checks for you, and you can try it at the end of this article. Here is what it looks at, in the order a stranger would.

September 20, 2026 3 minutes

Login Names Are Half a Login

By default, a WordPress site will list its users for anyone who asks. You get every author's login name, in a machine-readable list, at a fixed address. Attackers don't have to guess who the accounts are. They only have to guess the passwords. This post covers where the list comes from, how the free audit reports it, and four changes that close it without locking anyone out.

All articles

    Powered by LFW Search
    Prefer to write?

    Tell us what needs to work better.

    Slow, fragile, hard to edit, missing a workflow. Say it plainly, and you'll get a straight answer, not a ticket number.