Forms People Can Finish

A badly built form is where people give up. You will let the browser check answers with built-in validation, learn why the server must check again, help phones fill in forms with autocomplete and the right keyboard, and write hints and error messages everyone can use.

Updated

Form Validation

  1. Built-in Validation (Apprentice): A few HTML attributes let the browser check a form's answers before it sends them, so people fix a missing email or a short ZIP code right away, with no JavaScript.
  2. Why the Server Checks Again (Journeyman): The browser's checks help people fill in a form, but anyone can switch them off, so the server that receives the answers must check every one again.

Helping People Fill It In

  1. Autocomplete and Phone Keyboards (Journeyman): The autocomplete, inputmode and enterkeyhint attributes let a browser fill in what it already knows and give a phone the right keyboard, so a form takes seconds instead of minutes.
  2. Hints and Error Messages Everyone Can Use (Journeyman): Hints tied to their fields with aria-describedby, required fields marked in words, error messages that say how to fix the problem, and one column in a sensible order make a form everyone can finish.

Exercise: Fix the Frustrating Sign-Up Form

  1. Exercise: Fix the Frustrating Sign-Up Form (Journeyman): Fix Peak Fitness's frustrating sign-up form with real labels, the right types, autocomplete, hints and required fields marked in words, then let the checks and a keyboard-only run prove it works.