The FormDataEvent()
constructor creates a new FormDataEvent
object instance.
Syntax
new FormDataEvent(type[, formEventInit]);
Values
type
- A
DOMString
representing the name of the event. formEventInit
Optional- A
FormEventInit
dictionary, which can take the following optional fields:bubbles
: aBoolean
indicating whether the event bubbles. The default isfalse
.cancelable
: aBoolean
indicating whether the event can be cancelled. The default isfalse
.composed
: aBoolean
indicating whether the event will trigger listeners outside of a shadow root (seeEvent.composed
for more details). The default isfalse
.formData
: AFormData
object to pre-populate the FormDataEvent with. This would then be accessed through theFormDataEvent.formData
property.
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 | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'FormDataEvent' in that specification. |
Living Standard | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
FormDataEvent() constructor | Chrome Full support 77 | Edge Full support 79 | Firefox Full support 72 | IE No support No | Opera Full support 64 | Safari No support No | WebView Android Full support 77 | Chrome Android Full support 77 | Firefox Android No support No | Opera Android Full support 55 | Safari iOS No support No | Samsung Internet Android Full support 12.0 |
Legend
- Full support
- Full support
- No support
- No support