web api interface
FormData
Available in workers
The FormData interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), send() or sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
You can also pass it directly to the URLSearchParams constructor if you want to generate query parameters in the way a <form> would do if it were using simple GET submission.
An object implementing FormData can directly be used in a for...of structure, instead of entries(): for (const p of myFormData) is equivalent to for (const p of myFormData.entries()).
Constructor
FormData()- : Creates a new
FormDataobject.
- : Creates a new
Instance methods
append()- : Appends a new value onto an existing key inside a
FormDataobject, or adds the key if it does not already exist.
- : Appends a new value onto an existing key inside a
delete()- : Deletes a key/value pair from a
FormDataobject.
- : Deletes a key/value pair from a
entries()- : Returns an iterator that iterates through all key/value pairs contained in the
FormData.
- : Returns an iterator that iterates through all key/value pairs contained in the
get()- : Returns the first value associated with a given key from within a
FormDataobject.
- : Returns the first value associated with a given key from within a
getAll()- : Returns an array of all the values associated with a given key from within a
FormData.
- : Returns an array of all the values associated with a given key from within a
has()- : Returns whether a
FormDataobject contains a certain key.
- : Returns whether a
keys()- : Returns an iterator iterates through all keys of the key/value pairs contained in the
FormData.
- : Returns an iterator iterates through all keys of the key/value pairs contained in the
set()- : Sets a new value for an existing key inside a
FormDataobject, or adds the key/value if it does not already exist.
- : Sets a new value for an existing key inside a
values()- : Returns an iterator that iterates through all values contained in the
FormData.
- : Returns an iterator that iterates through all values contained in the
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.