From 087a303d5ab74e330ec18ea28343efcd540e3c4b Mon Sep 17 00:00:00 2001 From: MeGaurav4 Date: Wed, 9 Sep 2026 09:01:05 +0530 Subject: [PATCH 1/2] docs(WebAPI): call out duplicate keys on FormData iteration methods Signed-off-by: MeGaurav4 --- files/en-us/web/api/formdata/entries/index.md | 2 ++ files/en-us/web/api/formdata/keys/index.md | 2 ++ files/en-us/web/api/formdata/values/index.md | 2 ++ 3 files changed, 6 insertions(+) diff --git a/files/en-us/web/api/formdata/entries/index.md b/files/en-us/web/api/formdata/entries/index.md index 71cd4ed75f41d93..6cebf1695b59df3 100644 --- a/files/en-us/web/api/formdata/entries/index.md +++ b/files/en-us/web/api/formdata/entries/index.md @@ -10,6 +10,8 @@ browser-compat: api.FormData.entries The **`FormData.entries()`** method returns an [iterator](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) which iterates through all key/value pairs contained in the {{domxref("FormData")}}. The key of each pair is a string, and the value is either a string or a {{domxref("Blob")}}. +> **Note:** Unlike [`Map`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) entries, `FormData` entries are not necessarily unique by key. A form can contain multiple elements with the same name, so the same key may appear in more than one pair while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). + ## Syntax ```js-nolint diff --git a/files/en-us/web/api/formdata/keys/index.md b/files/en-us/web/api/formdata/keys/index.md index 09a273885fe9ebf..beecf7ab9121b05 100644 --- a/files/en-us/web/api/formdata/keys/index.md +++ b/files/en-us/web/api/formdata/keys/index.md @@ -10,6 +10,8 @@ browser-compat: api.FormData.keys The **`FormData.keys()`** method returns an [iterator](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) which iterates through all keys contained in the {{domxref("FormData")}}. The keys are strings. +> **Note:** Unlike [`Map`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) keys, `FormData` keys are not necessarily unique. A form can contain multiple elements with the same name, so the same key may appear more than once while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). + ## Syntax ```js-nolint diff --git a/files/en-us/web/api/formdata/values/index.md b/files/en-us/web/api/formdata/values/index.md index a422cd53c0f9c4f..fd88317b489dee4 100644 --- a/files/en-us/web/api/formdata/values/index.md +++ b/files/en-us/web/api/formdata/values/index.md @@ -10,6 +10,8 @@ browser-compat: api.FormData.values The **`FormData.values()`** method returns an [iterator](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) which iterates through all values contained in the {{domxref("FormData")}}. The values are strings or {{domxref("Blob")}} objects. +> **Note:** `FormData` keys are not necessarily unique. A form can contain multiple elements with the same name, so values sharing one key each appear while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). + ## Syntax ```js-nolint From efef4917caed0e5594f24739cfe01bb648930905 Mon Sep 17 00:00:00 2001 From: MeGaurav4 Date: Wed, 9 Sep 2026 10:24:17 +0530 Subject: [PATCH 2/2] Use GFM alert syntax for FormData duplicate-key notes Signed-off-by: MeGaurav4 --- files/en-us/web/api/formdata/entries/index.md | 3 ++- files/en-us/web/api/formdata/keys/index.md | 3 ++- files/en-us/web/api/formdata/values/index.md | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/files/en-us/web/api/formdata/entries/index.md b/files/en-us/web/api/formdata/entries/index.md index 6cebf1695b59df3..ff88957bad9da72 100644 --- a/files/en-us/web/api/formdata/entries/index.md +++ b/files/en-us/web/api/formdata/entries/index.md @@ -10,7 +10,8 @@ browser-compat: api.FormData.entries The **`FormData.entries()`** method returns an [iterator](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) which iterates through all key/value pairs contained in the {{domxref("FormData")}}. The key of each pair is a string, and the value is either a string or a {{domxref("Blob")}}. -> **Note:** Unlike [`Map`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) entries, `FormData` entries are not necessarily unique by key. A form can contain multiple elements with the same name, so the same key may appear in more than one pair while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). +> [!NOTE] +> Unlike [`Map`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) entries, `FormData` entries are not necessarily unique by key. A form can contain multiple elements with the same name, so the same key may appear in more than one pair while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). ## Syntax diff --git a/files/en-us/web/api/formdata/keys/index.md b/files/en-us/web/api/formdata/keys/index.md index beecf7ab9121b05..51e2e8c787359a9 100644 --- a/files/en-us/web/api/formdata/keys/index.md +++ b/files/en-us/web/api/formdata/keys/index.md @@ -10,7 +10,8 @@ browser-compat: api.FormData.keys The **`FormData.keys()`** method returns an [iterator](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) which iterates through all keys contained in the {{domxref("FormData")}}. The keys are strings. -> **Note:** Unlike [`Map`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) keys, `FormData` keys are not necessarily unique. A form can contain multiple elements with the same name, so the same key may appear more than once while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). +> [!NOTE] +> Unlike [`Map`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) keys, `FormData` keys are not necessarily unique. A form can contain multiple elements with the same name, so the same key may appear more than once while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). ## Syntax diff --git a/files/en-us/web/api/formdata/values/index.md b/files/en-us/web/api/formdata/values/index.md index fd88317b489dee4..92105aa21553b12 100644 --- a/files/en-us/web/api/formdata/values/index.md +++ b/files/en-us/web/api/formdata/values/index.md @@ -10,7 +10,8 @@ browser-compat: api.FormData.values The **`FormData.values()`** method returns an [iterator](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) which iterates through all values contained in the {{domxref("FormData")}}. The values are strings or {{domxref("Blob")}} objects. -> **Note:** `FormData` keys are not necessarily unique. A form can contain multiple elements with the same name, so values sharing one key each appear while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). +> [!NOTE] +> `FormData` keys are not necessarily unique. A form can contain multiple elements with the same name, so values sharing one key each appear while iterating. To retrieve all values associated with a single key, use the {{domxref("FormData.getAll()", "getAll()")}} method (or {{domxref("FormData.get()", "get()")}} for only the first value). ## Syntax