-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the FormData constructor submitter parameter #23950
Conversation
2d730c6
to
de47be4
Compare
Preview URLs (7 pages)
Flaws (1)Note! 6 documents with no flaws that don't need to be listed. 🎉 URL:
External URLs (1)URL:
(comment last updated: 2023-03-13 15:01:57) |
de47be4
to
e88099d
Compare
cc @annevk |
- : An HTML {{HTMLElement("form")}} element — when specified, the {{domxref("FormData")}} object will be populated with the form's current keys/values using the name property of each element for the keys and their submitted value for the values. It will also encode file input content. | ||
- : An HTML {{HTMLElement("form")}} element — when specified, the {{domxref("FormData")}} object will be populated with the `form`'s current keys/values using the name property of each element for the keys and their submitted value for the values. It will also encode file input content. | ||
- `submitter` {{optional_inline}} | ||
- : A {{Glossary("submit button")}} that is a member of the `form`. If the `submitter` has a `name` attribute or is an `{{HtmlElement('input/image', '<input type="image">')}}`, it will be included in the form data set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- : A {{Glossary("submit button")}} that is a member of the `form`. If the `submitter` has a `name` attribute or is an `{{HtmlElement('input/image', '<input type="image">')}}`, it will be included in the form data set. | |
- : A {{Glossary("submit button")}} that is a member of the `form`. If the `submitter` has a `name` attribute or is an `{{HtmlElement('input/image', '<input type="image">')}}`, the value of the name attribute will be included in the form data set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be misleading, as that could be understood to mean the value
attribute. While the name
+ value
are included for a <button>
or <input type="submit">
, that's not the case for an <input type="image">
(i.e. value
is unused and instead you get two entries for the x/y coordinate).
Maybe we could say something like ..., its value(s) will be included ...
, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could split it into two sentences, like on the Submit button
page. Or perhaps keep the original wording but have will be included
link directly to the relevant Form data entries
heading on the Submit button
page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the wording slightly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's still not quite accurate, as name-less image inputs will add entries to the form data set. e.g. clicking <input type="image" />
will yield something like x=123&y=234
How about this wording tweak, which also adds an example for the common case?
A {{Glossary("submit button")}} that is a member of the `form`. If the `submitter`
has a `name` attribute or is an `{{HtmlElement('input/image', '<input type="image">')}}`,
its data [will be included](...) in the form data set (e.g. `buttonName=buttonValue`).
will be included
would link directly to the relevant explainer on the Submit button
page.
This pull request has merge conflicts that must be resolved before it can be merged. |
This pull request has merge conflicts that must be resolved before it can be merged. |
e88099d
to
b763944
Compare
Rebased and made some wording tweaks, also added some more links. LMK what you think @jpmedley, thanks! |
Added a entry for the firefox 111 release when this is landing |
This pull request has merge conflicts that must be resolved before it can be merged. |
Also add a "Submit button" glossary page and link to it from various places to help facilitate a consistent and correct understanding of what a submit button is :) Spec PR (merged): whatwg/xhr#366 Spec: https://xhr.spec.whatwg.org/#interface-formdata
9ac622d
to
593fed5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Great work 👍
Description
Document the FormData constructor submitter parameter.
Also add a "Submit button" glossary page and link to it from various places to help facilitate a consistent and complete understanding of what a submit button is :)
Motivation
This is a new feature which is landing in major browsers soon, so it would be useful to have it documented.
Additional details
Spec: https://xhr.spec.whatwg.org/#interface-formdata
Spec PR (merged): whatwg/xhr#366
Chromium implementation (landing in Chrome 112): https://chromium-review.googlesource.com/c/chromium/src/+/4189297
WebKit implementation (landing in Safari 16.4): WebKit/WebKit#9188
Gecko implementation (landing in Firefox 111): https://phabricator.services.mozilla.com/D167576
Related issues and pull requests
Fixes #23917