FormDataEvent()
The FormDataEvent() constructor creates a new FormDataEvent object instance.
Syntax
new FormDataEvent(type[, formEventInit]);
Values
type-
A
DOMStringrepresenting the name of the event. -
formEventInitOptional -
A
FormEventInitdictionary, which can take the following optional fields:-
bubbles: atrueorfalsevalue indicating whether the event bubbles. The default isfalse. -
cancelable: atrueorfalsevalue indicating whether the event can be cancelled. The default isfalse. -
composed: atrueorfalsevalue indicating whether the event will trigger listeners outside of a shadow root (seeEvent.composedfor more details). The default isfalse. -
formData: AFormDataobject to pre-populate the FormDataEvent with. This would then be accessed through theFormDataEvent.formDataproperty.
-
Examples
let fd = new FormData(); fd.append('test', 'test'); let fdEv = new FormDataEvent('formdata', { formData: fd }); for (let value of fdEv.formData.values()) { console.log(value); }
Specifications
| Specification |
|---|
| HTML Standard (HTML) # the-formdataevent-interface |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
FormDataEvent |
77 |
79 |
72 |
No |
64 |
No |
77 |
77 |
No |
55 |
No |
12.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FormDataEvent/FormDataEvent