[whatwg] Form Serialization

Michael A. Puls II shadow2531 at gmail.com
Tue Jan 6 21:11:07 PST 2009


On Tue, 06 Jan 2009 17:07:00 -0500, Ian Hickson <ian at hixie.ch> wrote:

> On Tue, 6 Jan 2009, Michael A. Puls II wrote:
>> >
>> > Are browsers actually buggy here?
>>
>> You probably won't buy it, but I like the idea of using a form as a user
>> input data gatherer for in-page js-based apps where you do custom things
>> with the data and often don't actually submit the data anywhere.
>
> Oh this is quite common, I'm just not entirely sure that the form data  
> set
> serialised is a good way of handling that data.

I see. It might be better if there was a getFormData() that returned:

{
    "name1" : ["value1", "value2"],
    "name2" : ["value1", "value2"],
};

Or, for exact order of a appearance in the <form> with duplicates flat-like:

[
    {"name1" : "value1"},
    {"name2" : "value1"},
    {"name2" : "value2"},
    {"name1" : "value2"}
];
(Kind of like vector<pair<string, string> >)

Not sure if you'd want it to produce:

{"image1" : "file.png"}

or something like:

{"image1" : {"file.png" : "data:image/png,base64... }}

or both depending on an option and the form method. But, just mentioning it.

> However, I've added it to the list of missing features; once browsers are
> more consistent with their forms handling we can consider adding it then.

O.K.

>> > Why would we not want the browser vendors to just fix those bugs
>> > rather than implement new ones?
>>
>> If the vendor agrees it's bug, plans to fix it and can do it in a timely
>> manner, sure. Otherwise, you get people to starting fixing things
>> themselves (js libs do that in a way).
>
> Well if the browser vendors don't agree it's a bug, they might not agree
> that this is a feature worth implementing either. If they don't have the
> time to fix the bug, they might not have the time to implement this
> feature either.

Yep, true.

> And if they do implement this feature, it'll likely have
> the same bug since it would just be exposing the same code.

True. Depending on the bug though, you might be able to doctor up the broken dataset before it goes out to workaround the bug.

I'll try to implement a getFormData() in JS how I think it should be while trying to follow the spec and provide feedback.

-- 
Michael





More information about the whatwg mailing list