Accessing FormData Values

It seems you can't get values of the form element using FormData.

The FormData object lets you compile a set of key/value pairs to send using XMLHttpRequest. Its primarily intended for use in sending form data, but can be used independently from forms in order to transmit keyed data. The transmitted data is in the same format that the form's submit() method would use to send the data if the form's encoding type were set to "multipart/form-data".

However you can achieve it using simple Javascript like this

var formElements = document.forms['myform'].elements['inputTypeName'].value;

First thing I don't think it's possible to build a FormData object from a form as you've specified, and to get values from the form use the method described in the accepted answer -- this is more of an addendum!

It looks like you can get some data out of a FormData object:

var formData = new FormData();
formData.append("email", "[email protected]");
formData.append("email", "[email protected]");

this will only return the first item for that key, in this case it will return '[email protected]', to get all the email addresses use the below code


Please see also: MDN article on formdata get method.

FormData.get will do what you want in a small subset of browsers - look at the browser compatibility chart to see which ones (currently only Chrome 50+ and Firefox 39+). Given this form:

<form id="form">
  <input name="inputTypeName">

You can access the value of that input via

var form = new FormData(document.getElementById("form"));
var inputValue = form.get("inputTypeName");