liveBook · Manning

Web form

As explained in Architecting Accessibility

An interface for collecting and submitting user-provided information through a web page.

A web form collects user input and sends it to a server, but its real job is helping someone finish a task. A person may find the right product yet abandon a purchase because registration or checkout is hard to complete. Barriers can be especially consequential for keyboard, speech-input, and assistive-technology users, and for people with low vision or cognitive or motor disabilities. section 6.1 section 6.7

Start with native HTML: <form> contains controls such as <input>, <select>, and <textarea>, with <button> for actions. A submit button sends the entered values to the form’s action destination. Use an appropriate input type so the browser can offer suitable controls and data-entry support. Prefer native controls to a clickable <div>: recreating expected semantics and keyboard behavior adds work and risk. section 6.1 section 6.1.3

Turn a difficult form into a usable task

A provider-search form that uses placeholders instead of labels and <div> elements for its actions may look familiar while leaving users without persistent field names or dependable controls. Give each field a visible <label> connected by for and id. Group owner, dog, and complaint details with <fieldset> and <legend>; mark required fields in text and with required; use type="email" for email and a <textarea> for the complaint. On submission, identify errors beside affected fields and provide an error summary that receives keyboard focus. section 6.1 section 6.1.10

<div class="form-row" id="owner-name-group">
  <label for="owner-name">
    Owner's name <span class="required-text">(required)</span>
  </label>
  <p id="owner-name-error" class="error-message" hidden></p>
  <input id="owner-name" 
    name="owner_name" 
    type="text" 
    autocomplete="name" 
    autocapitalize="words"
    spellcheck="false"
    required 
    aria-describedby="owner-name-hint owner-name-error" />
  <div id="owner-name-hint" class="hint">
    Enter the owner's first and last name.
  </div>
</div>

The owner-name field shows the pieces working together: a persistent label, visible required marker, autocomplete hint, and an aria-describedby connection to guidance and an error message. section 6.1.10

TIP: Give instructions before users need to guess a format or constraint. For longer forms, put related fields in a logical sequence so the task feels manageable. NOTE: Browser validation can help prevent mistakes, but server-side validation remains essential for security and data integrity. section 6.7

How Architecting Accessibility covers it

How deep it goes
Works through an accessible form refactoring, from labels and grouping to input attributes, actions, and error presentation.
Examples
Contrasts a problematic provider-search form with labeled, grouped fields, native buttons, and an error summary.
What you can do after
Build it from scratch with native controls, associated labels, clear instructions, logical groups, and recoverable errors.
How it connects
Connects semantic HTML, accessible names, keyboard interaction, cognitive workload, and form validation.

Also explained in

Compare how 16 books explain web form →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.