Structured forms: what the check tests and how to fix it

Weight 1. Share of forms whose fields all have a name and a label. 80% passes. Skipped when no crawled page has a form.

Agent Protocols · Weight 1 in the w2agent Score

How common is it?

45% of 671 measured sites where this check applied pass.

Latest audit of each site under rubric v3.1. Sites where the check did not apply or could not be measured (for example, no llms.txt for the llms.txt checks) are left out. A partial result does not count as a pass.

What this check tests

The audit counts every <form> in the HTML of every page it crawled (the homepage plus up to nine more). For each form it looks at every <input>, <select> and <textarea>, skipping inputs of type hidden or submit. A form is well structured only when every one of those fields passes both tests:

  • It has a non-empty name attribute.
  • It has a label. That means a <label for> whose value equals the field's id, or, only when the field has no id, an enclosing <label>; or an aria-label or aria-labelledby attribute.

The score is the share of well-structured forms, rounded:

ResultWhen
Pass80 or more
Partial1 to 79
Fail0
SkipNo form on any crawled page. The message says not applicable

Details that decide outcomes:

  • A field with an id that sits inside a wrapping <label> but has no matching for is not counted as labeled, even though browsers treat that as a valid association.
  • placeholder and title do not count as labels.
  • type="button", reset and image inputs are checked like text fields, so an <input type="reset"> without a name fails its form. <button> elements are not inputs and are ignored.
  • Forms added by JavaScript after load are not seen, because the audit reads the HTML it fetched.

Why it matters to agents

Google's web.dev guide for agent-friendly sites says to add the for attribute on <label> tags to link them to inputs, because it helps the agent understand the purpose of a field. It describes agents reading the page through screenshots, the HTML and the accessibility tree, and recommends semantic HTML. The W3C and MDN guidance on labels is written for accessibility, and the same markup serves both audiences.

Names matter for a second reason. In Chrome's WebMCP documentation, the example form shows each field's name becoming a property of the tool's input schema, and the field's label supplying its description when no toolparamdescription is set. That API is experimental; see WebMCP declarative.

None of these sources says that labelled forms raise visibility in any assistant. The payoff is that an agent can complete a task on your site, such as a search, booking or contact request.

How to fix it

  1. List the forms the audit counted. A site-wide search box in the header counts on every page, so one unlabeled search field can fail most of your forms.
  2. Give each field a name, and a visible <label> tied to it:
<form action="/search">
  <label for="q">Search the docs</label>
  <input type="search" id="q" name="q">
  <button type="submit">Search</button>
</form>
  1. Where a visible label does not fit the design, use aria-label, or a visually hidden <label>; W3C WAI shows both.
  2. If a field has an id and sits inside a wrapping <label>, add the for attribute too. It is valid and the audit then counts it.
  3. Use <button> elements for buttons, since the audit ignores them. If you keep <input type="reset"> or type="button", give it a name and a label.

If you have no forms, the skip is correct and nothing needs adding. For exposing a form as an explicit tool, see WebMCP declarative; for markup that describes actions without a form, see action schemas.

Examples from measured sites

Up to 10 of the highest-scoring sites in each group, from recent audits. Failing includes partial results.

Passing

Failing or partial

Sources

Verified against these sources on

Does your site pass this check?

Check your own site →