Browsers & softwarePractical guides

Why a visible form field is missing from FormData

A visible product identifier is not proof that the browser includes it in form data. Native form submission and new FormData(form) use control state and names to build the field set. Inspect that set first. This guide covers ordinary text controls; custom JSON submission code can follow different rules.

Hand marking choices on paper beside computer equipment
Illustrative photo: Jakub Żerdzicki · Unsplash LicenseStock illustration for the topic, not a screenshot, test of the pictured equipment or product recommendation.

Key Takeaways

A named, enabled text input can remain in FormData when it is readonly. A disabled input is omitted, and an unnamed input contributes no corresponding key. Compare the serialized keys and values before changing the UI. Neither readonly nor disabled replaces server checks of identity, authorization or allowed values.

In this article

Check whether the key exists at all

The FormData constructor documentation describes collecting eligible form controls through their names and current values. This example has no formdata listeners or custom JSON builder. If a real application changes the data afterward, inspect that separate transformation too.

An absent key differs from a present key containing an empty string. Record the actual keys rather than assuming the server erased A-17. A numeric validity error belongs to a different check: see min, step and numeric input validity.

Four visible inputs produce two initial keys

This is an authored HTML sample. On December 2, 2026, the editor executed it in an isolated Edge 158.0.4370.45 page and inspected local FormData. No form request was sent and no real product record was read. Every input uses the default text type.

Open your own test HTML and inspect its console

<form id="sample">
  <input name="sku" value="A-17" disabled>
  <input name="batch" value="B-02" readonly>
  <input name="quantity" value="3">
  <input value="note">
</form>
<script>
  const form = document.querySelector("#sample");
  console.log([...new FormData(form)]);
  // [["batch", "B-02"], ["quantity", "3"]]
</script>
The script is example material; this article does not execute the HTML.

Observed isolated result
InputStateInitial FormData
sku=A-17disabled; namedNo sku key
batch=B-02readonly; namedbatch=B-02
quantity=3enabled; namedquantity=3
noteNo nameNo corresponding key

Choose a repair that matches the field contract

If sku must be transmitted but should not be edited in the UI, consider readonly on a supported text input and retain its name. If it is genuinely inapplicable, keep it disabled and define how the server obtains the value from trusted context. Do not enable every control merely to make the payload look complete.

In the same isolated check, setting sku.disabled to false added sku=A-17 to a new FormData object. Changing the readonly batch value through script to B-03 also changed the serialized value. Readonly constrains ordinary user editing; it does not authenticate a request value.

The readonly reference excludes select, checkboxes and file inputs. Adding readonly to an arbitrary control does not give it the text-input behavior. Disabled controls also affect focus and interaction. After a change, use the keyboard path and focus checks where appropriate.

Verify each boundary separately

In an authorized test environment, inspect the current control attributes, constructed key/value list, outgoing payload, server input and saved record in that order. This browser sample verifies only the first two; it does not establish successful saving in a business application.

A hidden copy, a readonly flag or a correct value in developer tools is not authorization. The server must check who is acting, which fields may change and which source determines the value. If the UI and server requirements disagree, repair the contract rather than treating a correct-looking unnamed field as a completed submission.

Further reading & sources