Paj Digital Labs
All articles
Web Design & Engineering

Forms That Convert: Validation, Error Messages and Not Losing User Input

Forms are where websites make money and where they lose it. Inline validation done right, error messages people understand, and the engineering that makes sure nobody ever retypes a long form.

Paj Digital Labs 3 min read
Web design workspace with desktop and laptop displays
Editorial illustration · Web Design & Engineering

Almost every business goal on a website ends in a form: a signup, a quote request, a checkout, a contact message. And forms are where frustrated visitors leave. Most of the friction comes from a handful of avoidable mistakes.

Ask for less

Every field costs completions. Before styling anything, question every input:

  • Do we need a phone number, or would email do?
  • Do we need first and last name separately?
  • Can we ask this later, after they have signed up?

Removing two optional fields from a quote form I worked on raised completions by roughly a fifth. No redesign, just fewer questions.

Validate at the right moment

Showing "invalid email" while someone is still typing their address is annoying. Showing all errors only after submit is frustrating. The better pattern:

1. Validate a field when the user leaves it (on blur). 2. Once a field has shown an error, re-validate as they type so the error clears the moment it is fixed. 3. Validate everything again on submit, and move focus to the first error.

ts
function onBlur(field) {
  touched[field] = true;
  errors[field] = validate(field, values[field]);
}
function onInput(field, value) {
  values[field] = value;
  if (touched[field]) errors[field] = validate(field, value);
}

Write errors that help

| Unhelpful | Helpful | |---|---| | "Invalid input" | "Enter a date like 14/10/2026" | | "Error" | "Password needs at least 12 characters" | | "Field required" | "Enter your email so we can send the quote" |

Say what is wrong and how to fix it, in plain words, next to the field. Connect the message to the input with aria-describedby so screen readers announce it.

Use the right input types

type="email", type="tel", inputmode="numeric" and correct autocomplete values bring up the right mobile keyboard and let browsers fill details automatically. Autofill is the biggest free speed-up a form can get, and custom inputs that break it cost conversions.

Never lose what they typed

Nothing makes a person leave faster than losing a long message to a server error. Protect input:

  • Keep values on failed submission — never reset the form on error.
  • Save drafts locally for long forms so a refresh or closed tab does not erase them.
  • Disable the submit button while sending, and show progress, so people don't double-submit.
  • Handle network failure with a clear retry option instead of a generic error page.
ts
useEffect(() => {
  localStorage.setItem(class="text-code-string">"quote-draft", JSON.stringify(values));
}, [values]);

Clear the draft once submission succeeds.

Server validation still decides

Client-side validation is a convenience. The server must validate everything again, because anything in the browser can be bypassed. Share the same schema between client and server where possible so the rules never drift apart.

Spam without punishing humans

Hard puzzles hurt real users more than bots. Start with lighter measures: a hidden honeypot field, a minimum time-to-submit check, and rate limits per IP. Add an invisible challenge only if spam persists.

Confirm clearly

After success, say what happens next: "Thanks — we'll reply within one business day." Send a confirmation email for anything important. Uncertainty after submit leads to duplicate submissions and support emails.

Good forms feel invisible. They ask little, explain errors kindly, and never make anyone type the same thing twice.

Paj Digital Labs

The engineering journal of Paj Digital Solutions — hosting, server infrastructure and web engineering, written by the people who run the servers.

Related reading