Skip to main content

form-attr-references-form

Per HTML Living Standard §4.10.18.6, the form attribute on a form-associated element (button, fieldset, input, label, meter, object, output, progress, select, textarea) must, when specified, be the ID of a <form> element in the element's tree.

ID existence itself is the responsibility of no-refer-to-non-existent-id. This rule fires only when the referenced ID resolves to a non-<form> element.

❌ Examples of incorrect code for this rule

<div id="notaform">Not a form</div>
<input type="text" form="notaform" />

✅ Examples of correct code for this rule

<form id="form1"><!-- ... --></form>
<input type="text" form="form1" />

Interface

{
"form-attr-references-form": boolean
}

Require that a form-associated element's form attribute references an actual form element by ID.

Default Severity

error