Hi David, Anne and others,

On 26/04/12 13:55, Anne van Kesteren wrote:
On Wed, 18 Apr 2012 20:07:57 +0200, Bronislav Klučka <[email protected]> wrote:
FormData can be useful not only to be sent via XHR, but essentially to hold form values easily, e.g. you can have settings form (that you do not need to send any where = you do not need to store it or you store it in e.g. IndexDb), then get this settings and alter application according to this settings... Instead of doing exactly the same, but manually

Why would you not simply use a JavaScript object for this?
I recently met the following use case: create a FormData object from a <form />, send it to some listeners that can actually edit this FormData, to finally send it via a XHR to the server. Listeners can add some data (with FormData.append) but I would like them to be able to edit or remove data (for security concerns, or whatever else). The only solution I found is to create a new FormData-like object that mimics the real one but with the addition of some functions. In fact, I gently expose the “fields” object or array and transform it to a real FormData object when calling toString() or something like that.
By the way, some features are clearly missing on the FormData interface.

Best regards.

--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/





Reply via email to