GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

FormDataEvent: FormDataEvent() constructor

DOM

DOM

The **`FormDataEvent()`** constructor creates a new FormDataEvent object.

## Syntax

```js-nolint
new FormDataEvent(type, formEventInit)
```

### Parameters

- `type`
- : A string with the name of the event.
It is case-sensitive and browsers always set it to `formdata`.
- `options`
- : An object that, _in addition of the properties defined in Event()_, can have the following properties:
- `formData`
- : A FormData object to pre-populate the FormDataEvent with.
This would then be accessed through the FormDataEvent.formData property.

### Return value

A new FormDataEvent object.

## Examples

```js
const fd = new FormData();
fd.append("test", "test");

const fdEv = new FormDataEvent("formdata", { formData: fd });

for (const value of fdEv.formData.values()) {
console.log(value);
}
```

## Specifications

## Browser compatibility

## See also

- FormDataEvent

source: MDN Web Docs mirror · page

Cite this

"FormDataEvent: FormDataEvent() constructor". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/FormDataEvent/FormDataEvent

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·