22
HTML forms

HTML forms

The half of forms most projects re-implement in JavaScript: input types, built-in validation, autofill, file uploads, dialog, and accessible error patterns.

~ 138 min·9 lessons·updated apr 2026

What you'll learn


Lessons

Read in order. Each lesson stands on its own, but the order is deliberate.

9 lessons · ~135 min total

  1. 01
    The form element and submission
    action, method, enctype, target — what the browser does the second a user clicks submit, with no JavaScript at all.
    14 min
  2. 02
    Input types in 2026
    text, email, tel, url, number, date, time, color, range, search — what each gets you on mobile and desktop.
    17 min
  3. 03
    Labels and associations
    label for vs wrapping, fieldset and legend, aria-label as last resort.
    14 min
  4. 04
    Built-in validation
    required, pattern, min, max, minlength, maxlength, and the :invalid and :valid pseudos.
    16 min
  5. 05
    The Constraint Validation API
    setCustomValidity, checkValidity, reportValidity, and the :user-invalid pseudo.
    15 min
  6. 06
    Autofill and autocomplete
    The autocomplete token list and why it matters for password managers and UX.
    13 min
  7. 07
    File inputs and uploads
    input type=file, accept, multiple, capture, the File and FileList shape.
    15 min
  8. 08
    The dialog element
    Modal vs non-modal, showModal, focus, ::backdrop, and forms that submit to close a dialog.
    17 min
  9. 09
    Accessible error patterns
    aria-describedby, error summaries, focus management on submit, live regions for async errors.
    14 min

Prerequisites

  • · Comfortable with the basics of HTML tags and attributes
  • · Familiar with picking the right semantic element

After this, try