A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

FormData: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
No edit summary
 
Line 1: Line 1:
Ideas around changing the FormData API.
Defining the FormData format (multipart/form-data).


* Populate FormData from the server. (multipart/form-data entity -> FormData)
Each entry either has
* Get and manipulate FormData values.


==FormData Proposal==
Content-Disposition: form-data; name="..."


* void append(name, value [, filename]) — appends new entry to end of entries, normalizes Blob to File
or
* boolean has(name) — basic boolean check
* sequence<(DOMString or File)> get(name) — get all entries for name
* void remove(name) — removes *all* entries for name


Also support iterator on the object.
Content-Disposition: form-data; name="..."; filename="..."
Content-Type: ...


==XMLHttpRequest Proposal==
Issues:


responseType = "formdata"
* The HTML dirname feature seems to be one way only. Maybe the feature needs to be redesigned?
* If there is no name, imply "isindex"?
* Encoding: name appears to consist of bytes (per encoding of form)


Parse as multipart/form-data and populate FormData. Probably need to have a good definition of multipart/form-data first.
==HTML Idea==


XXX: The HTML dirname feature seems to be one way only. Maybe the feature needs to be redesigned?
Something like HTMLFormElement.populate(FormData) which updates all entries with the data from FormData. Maybe it should take a dictionary to indicate whether unaffected items should be cleared or retained.


XXX: If there is no name, imply "isindex"?
== History ==


==HTML Proposal==
Initially this page was about evolving the FormData API. That has long since happened.
 
Something like HTMLFormElement.populate(FormData) which updates all entries with the data from FormData. Maybe it should take a dictionary to indicate whether unaffected items should be cleared or retained.


[[Category:Proposals]]
[[Category:Proposals]]

Latest revision as of 10:46, 30 June 2014

Defining the FormData format (multipart/form-data).

Each entry either has

Content-Disposition: form-data; name="..."

or

Content-Disposition: form-data; name="..."; filename="..."
Content-Type: ...

Issues:

  • The HTML dirname feature seems to be one way only. Maybe the feature needs to be redesigned?
  • If there is no name, imply "isindex"?
  • Encoding: name appears to consist of bytes (per encoding of form)

HTML Idea

Something like HTMLFormElement.populate(FormData) which updates all entries with the data from FormData. Maybe it should take a dictionary to indicate whether unaffected items should be cleared or retained.

History

Initially this page was about evolving the FormData API. That has long since happened.