Build forms from the values and server behavior they actually require.
Submission and server rules
Choose a request method, name each value, and make every action explicit.
- HTML forms: choose GET for retrieval and POST for a state change
- HTML form names and disabled controls: know which values submit
- HTML constraint validation: improve feedback without trusting the browser
- HTML form ownership: connect an external submit button deliberately
- HTML submit overrides: one form, two deliberate destinations
- HTML button type: make every form action explicit
- HTML reset button: restore initial form values, not a saved record
- HTML formnovalidate: save a draft without publishing incomplete data
- HTML submitter value: identify which button sent the form
- HTML hidden inputs: carry a token without treating it as secret
- HTML search form: pair a search landmark with a real GET result route
Labels and choices
Keep controls named and group values according to the decision.
- HTML labels: bind each control to a durable accessible name
- HTML input types: choose controls from the value contract
- HTML radio and checkbox controls: submit choices with explicit values
- HTML select and textarea: preserve meaningful values and editable text
- HTML fieldset and legend: name a group before its choices
- HTML disabled fieldset: stop editing without implying saved state
- HTML optgroup and multiple select: make several choices explicit
- HTML required select: use an empty first choice when no decision exists
Text and numeric inputs
Match identifiers, quantities, and editing hints to their actual data model.
- HTML autocomplete and inputmode: describe purpose and keyboard hints
- HTML datalist: offer suggestions without closing the input
- HTML pattern: validate a field's syntax without claiming identity
- HTML length limits: bound user text and explain the stored rule
- HTML dirname: submit text direction beside the user's words
- HTML number or text input: choose by the value, not its digits
- HTML number boundaries: align min, max, and step with the real unit
- HTML text input assistance: keyboard hints are not validation
- HTML multiple email input: parse a list, not a single address
- HTML telephone input: preserve symbols and validate your own format
- HTML password autocomplete: distinguish current and new credentials
- HTML textarea wrap: distinguish display wrapping from submitted line breaks
- HTML contenteditable versus textarea: choose the data model first
Dates, ranges, and measured values
Separate display controls from the units and server decisions behind them.
- HTML date and time inputs: separate display from submitted values
- HTML range input: capture an approximate bounded choice
- HTML color input: collect a preference without making color the message
- HTML progress, meter, and output: three different value relationships
Files and image submissions
Budget bytes, count, content, and the activated submitter.
- HTML file upload forms: declare multipart encoding and bound the server
- HTML file accept: guide the picker, validate the upload on the server
- HTML multiple file input: accept several files without inventing a limit
- HTML image submit button: supply an action name and handle coordinates carefully
- HTML file capture: suggest a camera without treating it as permission
Common Mistakes
Each lesson explains a browser contract. An illustrative asset or endpoint is not a deployed service until its owner supplies and verifies it.
