Knowledge Institute · 8–10 minutes with practice

Connect an accessible web form to a single reliable data record

Follow an ordinary request from its visible user interface to validation, storage, and confirmation.

Digital Business & Operations Quick Courses

Learning objectives

Learn

An accessible form begins with meaningful labels, visible instructions, and a way to understand errors and confirmation. The server has to apply the actual rules even when the interface gives helpful previews. The data model states what each record represents and which relationships must hold. Rendering a success message is evidence of an interface event, and confirming a stored record is a separate check.

Build a document whose structure explains its purpose

HTML describes a document tree. An element usually has a start tag, content and an end tag; attributes configure that element. Nest elements according to their content rules and close them coherently. Browser error recovery can produce a tree different from the indentation you intended. Inspect the resulting document structure rather than treating a forgiving render as proof of correct markup. Void elements such as input do not wrap child content.

The document head contains metadata such as a useful title, character encoding and viewport configuration. The body contains the visible document. Use a main landmark for the principal content, headings for section relationships, paragraphs for prose and lists for parallel items. A heading is not merely a large-font paragraph. A table represents data with row/column relationships and headers; CSS layout, rather than a table of empty cells, should position unrelated page regions. An informative image needs alternative text that serves its role; a decorative image generally needs an empty alternative rather than an invented description.

Accessible operation is observable behavior

Test the form using the keyboard alone. Focus should reach the link and controls in a sensible order, remain visibly identifiable, and activate native controls with their expected keys. A placeholder is not a durable replacement for a label. Explain a failed field in text, associate its help/error with the control and set `aria-invalid="true"` when appropriate; remove that state after correction. An error summary can link to affected controls. When dynamically adding an error summary, choose a focus/status-announcement strategy deliberately rather than moving focus after every keystroke. Retain safe submitted values so recovery does not require re-entering unrelated work.

Color, contrast, screen-reader naming, zoom/reflow and keyboard behavior require their own observations. A successful automated label check does not establish that an error message is understandable or that a real screen-reader user completed the task. Likewise a mouse click on a custom div does not establish keyboard activation. Prefer native semantics and add ARIA only to describe behavior the implementation actually supplies. These are educational evaluation criteria, not a claim that this draft has already passed a complete accessibility audit.

Design the facts before the query

The original join-grain investigation assumes that tables already exist. Begin one step earlier. A relation represents rows with named attributes and a declared meaning for one row. For this fictional service, customers contains one row per customer, orders one per work order, and lines one per charged item. Customer names are descriptive values, not stable unique identities. A primary key identifies a row; a foreign key connects a row to an identified parent. An order's customer_id belongs in orders, while repeating the customer's current address in every order can create inconsistent copies unless the application deliberately stores a historical address snapshot.

Normalization is a way to examine dependencies among facts. If customer_id determines the customer's current name, store that name with the customer rather than allowing separate order rows to disagree about it. A line price charged at the time of an order is different from a product's current catalogue price, so keeping both need not be an accidental duplicate. State the historical policy before “normalizing away” a fact needed for reconstruction. A many-to-many relationship, such as orders assigned to several technicians and technicians assigned to several orders, needs an association relation with the intended uniqueness rule.

Apply

A fictional public-library page collects workshop registrations. Each registration refers to one workshop and one participant through defined identifiers, and the policy allows only one active registration for each pair. The interface lets a person submit without using a mouse, labels each field, and reports errors in text. On submission the server validates the request and accepts at most one active record for the pair. In a safe local test with invented inputs, send the same permitted request twice and check that the response explains the existing registration and that only one active record exists. Test recovery from a lost confirmation by observing the record through the normal authorized route.

Optional check

Why would checking that the form says “registered” after both submissions leave the invariant unresolved?

Show the explained answer

The message could appear even if the data store had two records. Verify the stated one-registration rule and the visible response separately.

Sources and further reading

Continue in Lawfare Academy

Full course · CS 220 — Web Applications, SQL and Software Engineering