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
Unknown
The definition of 'FormDataEvent' in that specification.
Living Standard Initial definition

Browser compatibility

BCD tables only load in the browser

See also