FormDataEvent()

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: a Boolean indicating whether the event bubbles. The default is false.
  • cancelable: a Boolean indicating whether the event can be cancelled. The default is false.
  • composed: a Boolean indicating whether the event will trigger listeners outside of a shadow root (see Event.composed for more details). The default is false.
  • formData: A FormData object to pre-populate the FormDataEvent with. This would then be accessed through the FormDataEvent.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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
FormDataEvent() constructorChrome Full support 77Edge No support NoFirefox Full support 72IE No support NoOpera Full support 64Safari No support NoWebView Android Full support 77Chrome Android Full support 77Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support

See also