Skip to main content
Best Web Developer logo
Language and currency EN £ GBP

Language

Currency

Prices on this site are shown in the currency you choose.

Insight

Building Forms with Validation That Users Don’t Hate

How to build form validation users do not hate: on-blur timing, specific error copy, forgiving input, accessibility, server checks, and Saudi phone, ID and RTL details, with a checklist and illustrative case.

  • 5 October 2026
  • 11 min read
  • Tutorials

Last updated: September 2026 · Reading time: 13 min · By the Best Web Developer team

Form validation example with inline error messages, accessible labels and a Saudi mobile number field
Good validation feels like help, not punishment: clear labels, forgiving input and errors that explain the fix.

Quick answer

Form validation users do not hate is forgiving, timely and specific. Validate after a field loses focus rather than on every keystroke, accept common input formats and normalise them, explain exactly how to fix each error next to the field, never clear what the user typed, and always repeat checks on the server. Make errors accessible to screen readers.

Key takeaways

  • Validate on blur, then re-validate live once a field has shown an error, so users see the fix confirmed instantly.
  • Accept many formats (spaces, dashes, Arabic-Indic digits) and normalise them, instead of rejecting reasonable input.
  • Error messages should say what is wrong and how to fix it, next to the field, in plain language.
  • Client-side validation is for usability; server-side validation is for security and data integrity. You need both.
  • For Saudi forms, handle +966 mobile numbers, 10-digit national and Iqama IDs, Arabic names and RTL error placement.

Why bad form validation costs you customers

Bad form validation costs customers because it turns a small mistake into a dead end. A user who sees “Invalid input” in red, with their password field cleared, often leaves rather than tries again.

Form validation is the process of checking that data entered into a form is complete and correctly formatted before it is accepted, and telling the user how to correct anything that is not. It happens in the browser for speed and on the server for safety.

Forms are where websites make money: checkouts, lead forms, bookings, account sign-ups. In our audits, fixing validation behaviour is one of the cheapest ways to raise completion rates. This guide covers the timing, wording, formats and accessibility rules we apply, with specific examples for Saudi and bilingual forms.

Note: who this is for

This guide is for designers, developers and marketers who own forms. Code examples are described in words so non-developers can use them as a specification, and developers can find implementation details in MDN Web Docs.


When to validate: timing rules for form validation

Timing decides whether validation feels helpful or hostile. The best default is to validate a field when the user leaves it, then switch to live checking once an error is showing.

Do not validate while the user is still typing

Showing “Invalid email” after the first character is the most common irritation. The user has not finished; the form is scolding them for being mid-sentence. Wait for the blur event, when focus leaves the field, before showing an error.

Re-validate live once an error appears

After a field shows an error, check it on every change so the message disappears as soon as the input becomes valid. This “reward early, punish late” pattern confirms the fix instantly and reduces anxiety.

Validate the whole form on submit

On submit, check every field, move focus to the first invalid one and show a summary at the top listing each error as a link to its field. This matters for long forms and screen reader users, who may not notice an inline message further down the page.

Use async checks sparingly

Checks that call the server, such as “is this username taken?”, should run after blur with a short debounce of around 300 to 500 ms, show a loading state and never block typing. Rate-limit them to avoid account enumeration.

Form validation timing diagram showing on-blur error, live re-validation and submit summary
Validate on blur, confirm fixes live and summarise errors on submit.

How to write form validation messages people understand

Good error messages are specific, polite and actionable. They tell the user what happened and exactly what to do next, in the language of the form.

Bad messageBetter messageWhy it works
Invalid inputEnter your email address, for example name@company.comExplains the expected format
Error: field requiredEnter your mobile number so we can confirm your bookingExplains why the field matters
Password does not meet requirementsAdd at least one number (8 characters minimum)Names the missing rule only
Invalid dateChoose a date after todayDescribes the valid range
Phone number invalidEnter a Saudi mobile number starting with 05 or +966 5Gives the local pattern

Rules we follow for error copy

  • Place the message directly below or beside the field, not only at the top of the page.
  • Use an icon and text as well as colour, so the error is visible to colour-blind users.
  • Avoid blame words such as “wrong”, “illegal” or “invalid” where possible.
  • Show password rules before the user types, and tick them off as they are met.
  • Write Arabic messages natively; translated error strings often read as rude or confusing.

Never destroy user input

When the server rejects a submission, return the form with every value still filled in, except card security codes. Clearing a long form because one field failed is the fastest way to lose a lead.

Highlight: the one-sentence test

Read each error message aloud to someone who has never seen the form. If they cannot fix the problem from that sentence alone, rewrite it.


Forgiving input, accessibility and our checklist

The best form validation prevents errors instead of reporting them. Accept flexible input, normalise it quietly and use the right input types so mobile keyboards help the user.

Accept and normalise formats

  • Phone numbers: accept spaces, dashes, brackets and a leading +966 or 0, then store in E.164 format such as +9665XXXXXXXX.
  • Digits: convert Arabic-Indic digits (٠١٢٣٤٥٦٧٨٩) to Western digits before checking, because many Saudi users type them.
  • Emails: trim spaces and lowercase the domain, but do not reject valid addresses with plus signs or long domains.
  • Names: allow Arabic, Latin, hyphens and apostrophes, and never force a “first name, last name” split if a single full-name field works.
  • Card numbers: allow spaces and format them in groups as the user types.

Use native input types and attributes

Setting type=”email”, type=”tel” and inputmode=”numeric” brings up the correct mobile keyboard. The autocomplete attribute lets browsers fill names, addresses and one-time codes automatically, which cuts effort dramatically on mobile.

Accessibility requirements

WCAG 2.2 includes success criteria on error identification, labels or instructions, error suggestion and redundant entry. In practice: every field has a visible label, errors are linked to fields with aria-describedby, the field is marked aria-invalid when it fails, and a live region or focus move announces errors to screen readers.

Pro tip

Test complex validation patterns before shipping them. Our free Regex Tester lets you check a Saudi mobile or ID pattern against real sample inputs, including edge cases with spaces and Arabic-Indic digits.

Checklist we use on every form

  1. Every field is necessary; remove anything sales or ops will not use.
  2. Labels are visible above fields, not placeholder-only.
  3. Required and optional fields are marked clearly.
  4. Validation runs on blur, re-validates live after an error and summarises on submit.
  5. Inputs accept common formats and normalise them.
  6. Server-side validation repeats every rule and sanitises all input.
  7. Errors are announced to screen readers and focus moves to the first error.
  8. Submit button shows a loading state and prevents double submission.

Illustrative case: a Dammam clinic booking form

Challenge: A clinic’s booking form rejected phone numbers with spaces or +966, rejected Arabic-Indic digits, cleared all fields on error and validated the email field on every keystroke. Completion was 38% of users who started it.

What we did: We reduced the form from 11 fields to 6, normalised phone numbers and digits, moved validation to on-blur with live re-checking, rewrote errors in Arabic and English, and added an accessible error summary. The work took three weeks and cost about SAR 14,000.

Result: Form completion rose from 38% to 67% over the next two months, booking requests grew by about 70%, and support calls from patients unable to book fell from roughly 40 to 9 per month.

Key benefits of user-friendly form validation

Better validation raises conversions, improves data quality and reduces support load at the same time. These are the gains teams see most often.

  • Higher completion rates: fewer abandoned checkouts, sign-ups and lead forms.
  • Cleaner data: normalised phone numbers and emails reach CRMs and WhatsApp tools correctly.
  • Lower support volume: fewer customers call because a form would not submit.
  • Accessibility compliance: forms that work with screen readers and keyboards meet WCAG expectations.
  • Better ad performance: higher landing-page conversion lowers cost per lead.
  • Stronger security: consistent server-side checks block malformed and malicious input.

Highlight: where the money is

Checkout and lead forms are usually the last step before revenue. A ten-point lift in completion there is often worth more than doubling top-of-funnel traffic.


Form validation for websites in Saudi Arabia

Saudi forms need local formats, bilingual messages and RTL-aware layouts. Generic validation libraries often get these wrong by default.

Local data formats

  • Mobile numbers: Saudi mobiles start with 05 locally or +966 5 internationally, followed by eight digits.
  • National ID and Iqama: both are 10 digits; national IDs typically start with 1 and resident Iqama numbers with 2.
  • Addresses: the Saudi National Address uses a building number, street, district, city, postal code and additional number; a short address code is also common.
  • VAT numbers: business forms for B2B invoicing under ZATCA FATOORA often collect a 15-digit VAT registration number.

RTL and bilingual behaviour

In Arabic layouts, error icons and messages should align to the right, and phone or ID fields often stay left-to-right inside an RTL page. Set dir=”ltr” on those inputs so digits do not reorder. Keep Arabic and English messages equally clear.

Privacy under the PDPL

The PDPL enforced by SDAIA requires a lawful basis and purpose for personal data. Collect only what you need, explain why sensitive fields such as ID numbers are required, link to the privacy notice next to the submit button and avoid sending raw form data to third-party analytics tools. Our UI/UX design service builds bilingual, PDPL-aware forms from the first wireframe.

“A form is a conversation. Validation is the moment your website either listens or interrupts.”
— Best Web Developer strategy team

Form validation approaches compared

Teams usually combine native browser validation, a JavaScript library and server checks. Each approach has strengths and limits.

ApproachStrengthsLimitationsBest use
Native HTML attributes (required, type, pattern)No JavaScript, mobile keyboards, fastDefault messages are generic and styling is limitedBaseline for every form
Custom JavaScript on blurFull control over timing and wordingMust be built accessiblyLead and booking forms
Form library (React Hook Form, Zod, Yup)Consistent rules, shared schemasAdds bundle weight, needs careful setupApps and complex checkouts
Server-side validationSecure, authoritativeSlower feedback aloneAlways required
Async server checksCatches taken usernames or bad codes earlyLatency, abuse riskSign-up and coupon fields

Highlight: share one set of rules

Where possible, define validation rules once in a shared schema used by both browser and server. It prevents the classic bug where the browser accepts a value that the server then rejects.


Frequently Asked Questions about form validation

When should form validation errors appear?

Show a field’s error after the user leaves the field, not while they are typing. Once an error is visible, re-check the field on every change so the message disappears as soon as the value is valid. On submit, validate every field, move focus to the first error and show a summary of all problems at the top.

Is client-side form validation enough?

No. Client-side validation improves usability by giving fast feedback, but anyone can bypass it by disabling JavaScript or sending requests directly. Server-side validation must repeat every rule, sanitise input and return clear errors. Treat browser checks as a convenience and server checks as the real protection for your data and systems.

How do I write a good form error message?

Say what is wrong and how to fix it in one short, polite sentence placed next to the field. Include an example or the expected format where useful, such as a sample email or a Saudi mobile pattern. Avoid generic words like “invalid”, use an icon as well as colour, and never clear the user’s input.

How should a form validate Saudi mobile numbers?

Accept numbers typed as 05XXXXXXXX, 5XXXXXXXX, +9665XXXXXXXX or 009665XXXXXXXX, with or without spaces and dashes, and convert Arabic-Indic digits to Western digits first. Then normalise to the international E.164 format for storage. Show an example such as 05X XXX XXXX in the hint text, and keep the input left-to-right in Arabic layouts.

What makes form validation accessible?

Every field needs a visible label, and errors must be identified in text, not only colour. Link each message to its field with aria-describedby, mark failing fields with aria-invalid, announce errors through a live region or by moving focus, and provide an error summary on submit. These steps support the WCAG 2.2 criteria on error identification and suggestions.

Should I use placeholder text instead of labels?

No. Placeholder text disappears when the user starts typing, which makes it hard to remember what a field needs and harder to fix errors. Placeholders also often fail contrast requirements. Use a visible label above each field and, if helpful, a short hint below it. Placeholders can show an example format as a secondary cue.

How many fields should a lead form have?

As few as your team will actually use. For most service lead forms, name, phone or email and a short message are enough; four to six fields is a common sweet spot. Every extra field lowers completion. Ask for detailed information later in the sales process, after the first contact is made.

Conclusion: form validation that helps instead of blocks

Form validation users do not hate follows a few firm rules: validate on blur, confirm fixes live, accept flexible input and normalise it, write specific error messages, keep user data on error, make everything accessible and always repeat checks on the server.

For Saudi and bilingual sites, add local phone and ID formats, Arabic-Indic digit handling, RTL-aware error layout and PDPL-minded data collection. Start with your highest-value form, measure completion before and after, and expand the pattern across the site.

Losing leads at the form?

We audit and rebuild checkout, booking and lead forms for bilingual Saudi and UK websites, with measurable completion targets. Send us the form URL and your current completion rate.

Get a free consultation See pricing
Tags: form validation, form UX, error messages, accessible forms, WCAG 2.2, conversion optimisation, Arabic RTL forms, Saudi phone numbers, PDPL, Vision 2030

Frequently asked questions

What does this page cover?

Building Forms with Validation That Users Don’t Hate explains how to build form validation users do not hate: on-blur timing, specific error copy, forgiving input, accessibility, server checks, and Saudi phone, ID and RTL… in practical terms: what it means, when it applies and what to do next. It is written for business owners and developers rather than for search engines, with the technical detail kept where it is useful.

Who is this written for?

Owners and marketing leads who need to make a decision, plus developers who want the implementation detail. Jargon is explained on first use and every recommendation can be acted on without buying anything.

Is this information current?

It is reviewed against current Google documentation and observed client results, and updated when the guidance changes. Anything time-sensitive is dated in the copy rather than left to drift.

Is it free to read?

Yes, with no paywall, no email gate and no signup. If it is useful, the only thing we ask is that you link to it when you quote it.

Can you implement this for us?

Yes. The same team that writes these guides delivers the work, so the advice and the implementation come from the same place rather than a content team and a separate agency.

Where can I read more?

Related guides, services and free tools are linked at the end of this page, and the full library is indexed in the sitemap so you can find the topic closest to your question.

Do you accept corrections?

Yes. If something here is out of date or wrong, tell us and it gets fixed with a visible update. Accurate technical writing is worth more to us than being right in public.

Need help implementing this?

Best Web Developer gives you a fixed quote, a dated plan and a senior developer who stays on the project from first call to launch. No account managers, no hourly surprises.

Request a quoteSee pricing

Want this handled for you?

We build and optimise sites like this every week. Book a free 30-minute call and we will tell you exactly what we would change on yours.

Get a free site review

Keep reading

Free strategy session

Let’s build something worth finding.

Tell us where you want the business to be in twelve months. We will come back with a costed plan, a realistic timeline, and the numbers we expect to move — no obligation, no jargon.

  • 30-minute call, no pitch deck
  • Fixed-price proposal in 48 hours
  • You own everything we build

Talk to a developer

Not a sales team

Response time
Within 1 business hour
Where we work
UK, USA & the Gulf
Contracts
No lock-in, monthly rolling
Working since
2023
infobestwebdeveloper.org
Free consultation

show prices in USD?

Get a free quoteWe reply within 1 business hour