W3C home > Mailing lists > Public > public-html@w3.org > August 2007

Form Serialization

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Thu, 16 Aug 2007 15:29:07 -0700
Message-ID: <c9e12660708161529kab4884eq1ca5f971eaccff8a@mail.gmail.com>
To: public-html@w3.org

FORMs are sometimes used for XMLHttpRequest. Most "AJAX" libraries
(DOJO, YUI, prototype, et c) already provide functionality for
serializing a FORM (even if indirectly, by associating a FORM with an
XMLHttpRequest ).

The process is to through the form and concatenate strings based on
form's successful controls.

This Serializing of a FORM by hand should not be necessary. Browsers
that support FORM submission serialize a form to a data set
automatically upon submission.

Proposal:

interface HTMLFormElement {
  String getDataSetString
  String toJSONString
};

toJSONString would return an object literal that contains the FORM
element's successful controls, using names as key and an LIST for each
key's value.

getDataSetString() would return a serialized data set representation
of the FORM's successful controls. It would look just like what you
see in a GET query string or a POST body.

For Binary Data, you can encode as JS escapes.

These methods should also apply to HTMLFieldsetElement.
Received on Thursday, 16 August 2007 22:29:13 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:48 UTC