FormData Methods for Inspection and Modification

Evangelises Chrome and the mobile web in the Developer Relations team at Google.

FormData is the XHR user's best friend, and it's getting an upgrade in Chrome 50.
We're adding methods allowing you to inspect your FormData objects or modify them after-the-fact.
You can now use get(), delete(), and iteration helpers like entries, keys, and more. (Check out the full list.)

If you're not already using FormData, it's a simple, well-supported API that allows you to programmatically build a virtual form and send it to a far away place using window.fetch() or XMLHttpRequest.send(formData).

For some examples, read on!

Parse real forms like a pro

FormData can be constructed from a real HTML form, taking a snapshot of all its current values.
However, the object used to be entirely opaque. All you could do was send it on, unchanged, to a server.
Now, you can take it, modify it, bop it, observe it, shrink it, change it, and finally, upload it:

Don't throw away your FormData

If you're building your own FormData from scratch, you might have found it frustrating that you couldn't reuse it - you've spent a lot of time on those fields!
As both the window.fetch() and XMLHttpRequest.send() methods takes a snapshot of the FormData, you can now safely reuse and modify your work!
Check this example out: