Three different relationships
id identifies an element in the document, label for references that id and name names the submitted entry. In the example, resumo serves both purposes for convenience, but values need not match. If a component changes id to avoid duplicates, it should update the corresponding label; it need not change the key expected by the server. A placeholder does not replace this persistent identification.
Participating controls
A control can be visible without contributing data. A text input without name supplies no entry and a disabled control is excluded. Readonly, on types supporting it, prevents direct editing but can retain the submitted value.
This is useful for presenting a fixed code, but does not guarantee request integrity: the server should confirm record identity and the right to change it.
Absence also has meaning
The example’s alerts checkbox submits avisos=email only when checked. Unchecked, it does not automatically submit false, zero or an empty string. The application should define how absence is interpreted.
In a partial edit, absence may mean leave unchanged; in a full replacement, it may mean disable. That decision belongs to the operation contract and should not be guessed from control appearance.
Button intent
Help uses type button to add neither submission nor reset to interaction. The two submitters have distinct values and the draft submitter overrides the form target with formaction. Validation remains active because the example contains no bypass.
When interpreting FormData constructed in code, consider the submitter parameter if its name/value is needed. Constructing that object is not itself an HTTP request.
Ownership and visual position
An input’s form attribute can associate it with a form in the same document even outside that element. Association uses the form id. But form on fieldset is not inherited by every input: each control needs appropriate association.
This matters when a side panel appears part of the same edit but resides elsewhere in the DOM. Review ownership and names as well as visual proximity.
Groups and disabling
fieldset and legend group related controls under a shared caption. Disabled on fieldset disables descendant controls except descendants of its first legend child. That exception can permit a control deciding whether to enable the group, but enabling logic does not arise automatically.
An independent disabled state remains relevant. Do not generalize the exception to every legend or every nested group.
Delivery contract
GET places data in the URL and suits searches without write effects; POST carries data in the body with applicable encoding. Neither method proves data valid, authorized or encrypted merely by being chosen. To diagnose a failure, identify the control, expected pair, submitter, method and target.
Only then compare the response. Questions ask for this reading of the flow without executing excerpts.
<form id="pedido" action="/pedidos" method="post">
<label for="codigo">Código do registo</label>
<input id="codigo" name="codigo" type="text" value="R7" readonly>
<fieldset>
<legend>Informação do pedido</legend>
<label for="resumo">Resumo</label>
<input id="resumo" name="resumo" type="text" required>
<label><input name="avisos" type="checkbox" value="email"> Receber avisos</label>
</fieldset>
<button type="button">Ajuda</button>
<button type="submit" name="intencao" value="enviar">Enviar</button>
<button type="submit" name="intencao" value="rascunho"
formaction="/pedidos/rascunho">Guardar rascunho</button>
</form>The fictional form includes the readonly code in data, requires a summary and submits alerts only when the checkbox is checked. The submitter distinguishes sending from draft saving and the latter changes the target. Validation is not bypassed for draft saving.
Help is a button without implemented behavior in the excerpt; endpoints are illustrative and provide neither persistence nor authorization.
Common pitfalls
Confusing for with name; expecting disabled fields to be submitted; treating unchecked checkboxes as automatic false; assuming fieldset form is inherited; ignoring formaction; trusting a code merely because it is readonly.
Related topics: Constraints, feedback and accessibility · Document structure and semantics · Diagnosing styles and delivery
Submission results from associated controls, names, states and the submitter. Predict these factors before attributing a missing value to the server. Data contracts and authorization still require server-side checking.
Reference: Native form delivery · HTML Living Standard; modular CSS