-
Notifications
You must be signed in to change notification settings - Fork 131
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
FormData: Add ability to specify submitter in addition to <form> #262
Comments
From that discussion, I think there's agreement on adding a second optional argument to address the use cases from @muan et al. If we were to extend |
Or alternatively this could be implicitly handled by implementations (i.e. the coordinate would be recorded when the user selects it, and later used when constructing the data set, as is the case with a normal form submission) |
Context: whatwg/html#3195
Context: #202
FormData should have ability to add an entry for a submitter button when it appends entries for a <form>.
We have multiple options of how to specify submitter. See five comments since whatwg/html#3195 (comment)
A)
constructor(optional (HTMLFormElement or record<USVString, FormDataEntryValue>) formOrMap, optional HTMLElement? submitter = null)
Idiomatic.
B)
constructor(optional (HTMLElement or record<...>) formOrSubmitterOrMap)
HTMLElement
represents a form or a submitter.C)
constructor(optional (HTMLFormElement or FormDataInit) formOrDict)
The content of the dictionary is idiomatic.
Need to wrap a record with a dictionary.
Extensible. It's easy to add new members to the dictionary in the future.
D)
constructor(optional (HTMLFormElement or FormDataInit or URLSearchParams) init)
FormData
doesn't supportrecord<>
directly. Developers have to writenew FormData(new URLSearchParams(map))
.E)
constructor(optional HTMLFormElement form, optional HTMLElement? submitter = null)
FormData append(record<USVString, FormDataEntryValue> map);
Developers have to write
new FormData().append(map)
.F) (no changes on the constructor)
Developers have to write
let fd = new FormData().append(form, submitter);
if they want to collect entries including an entry for the submitter.The text was updated successfully, but these errors were encountered: