Forms

The platform's oldest interactive component: input types, native validation, submission, focus order, labels — and what you inherit for free before any framework state exists.

Native Forms First

A `<form>` ships with submit-on-Enter, validation, autofill, password-manager integration and a label/control relationship. Most custom forms are a worse reimplementation of it.

Q · What does a real `<form>` element already do, and how much of it am I about to rewrite by accident?
Input Types, Inputmode and Autocomplete

The right `type`, `inputmode` and `autocomplete` change the on-screen keyboard, the autofill offer and the validation the browser runs — a large UX win for one attribute.

Q · Which attribute actually changes what a user sees when they tap a field, and what does each of them control?
Native Validation and Its Limits

The Constraint Validation API gives you checks, states and messages for free — then runs out at styling, wording and timing. Replacing it means re-implementing what it did well.

Q · What does the browser check for me, where does that stop being enough, and what am I taking on when I switch it off?
Controlled vs Uncontrolled Inputs

Either your framework owns every keystroke or the DOM does and you read at submit. A real trade-off between per-keystroke render cost and reactive capability — not a rule.

Q · Should the current value of this field live in framework state, or in the DOM until I need it?
Submission: Method, Encoding and Doing It Once

GET versus POST is a semantic choice with cache and history consequences; `FormData` and `enctype` decide what goes on the wire; and preventing the second submit is your job.

Q · What actually happens when this form is submitted, and how do I make sure it happens exactly once?
Errors People Can Actually Perceive

An error must be programmatically tied to its field, announced when it appears, reachable by focus and expressed in more than colour. Red text is not an error state.

Q · When a field is wrong, how does every user — including one who cannot see the screen — find out what is wrong and where?