0
Challenge · 67Architecture & State
Form Validation
Coreused in ~80% of apps
A form that submits garbage is a backend bug waiting to happen and a frustrated user staring at a vague error. Validation is the difference between a form that guides people to success and one that punishes them. The hard part isn't the rules — it's WHEN you show them.
Core idea. Validation = run rules over field values, derive an error message per field, and decide WHEN to surface it (as they type, when they leave a field, or when they submit). Client-side validation is purely UX; the server must validate again because anything in the browser can be bypassed.
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
VALIDATION TIMING
type
quiet
blur
quiet
submit
validates
Pick a timing mode, then type a bad email and watch WHEN the error appears.
Same field, three feels: onChange nags as you type, onBlur waits until you leave, onSubmit stays quiet until you try. Submit always checks everything.
↑ play a little first, then dig in