Re: Submitting forms as JSON

On Tue, Feb 25, 2014 at 11:02 AM, Robin Berjon <robin@w3.org> wrote:

> Hi,
>
> I put together a small spec to enable having HTML form data submitted
> directly as JSON, with structure. I'd be curious to hear your feedback:
>
>     http://darobin.github.io/formic/specs/json/
>
> Thanks!
>
> --
> Robin Berjon - http://berjon.com/ - @robinberjon
>
>

Robin,

Some thoughts all over the place...

Would this also modify the FormData serialization in XMLHttpRequest[1].
 That would be awesomely more useful to me.  It would also be wickedly
handy if there were a way to get at it (ie, some DOM method), probably more
useful than even the other two since it would let me polyfill the other two
with 1 underlying implementation that explains it.   <form>.toObjectModel()
or something which provides a single canonical non-DOM object
representation of the form which could be serialized and deserialized could
be used to explain how enctype="application/json" and corresponding
FormData in ajax would work too.  Of course, this begs the question of
whether there is a corresponding <form>.fromObjectModel() which could
populate the form given some data (kinda awesome), and whether both of
those are maybe just natively handleable custom serializations ala
JSON.stringify(form) and JSON.parse(form)..


http://www.w3.org/TR/XMLHttpRequest2/#interface-formdata



-- 
Brian Kardell :: @briankardell :: hitchjs.com

Received on Tuesday, 25 February 2014 19:19:48 UTC