Good point, Jörn. Not only would you want to be able to submit an empty
string value for an option, but if the "value" attribute is excluded
from the option tag, this.value will return the text between the tags
anyway.

m.

On Tue, 2006-10-03 at 11:17 +0200, Jörn Zaefferer wrote:
> Matt Grimm schrieb:
> > I've put together a fast form serializer function that I'm hoping can
> > get some review from the list for completeness, bugs, a better name,
> > etc. A previous thread revealed quite a performance issue with the form
> > plugin's existing serialize function when operating on a form with a
> > large number of elements. My plugin sacrifices semantic order for wicked
> > speed. I have a test form with a select menu containing 500 options --
> > with the current serializer, it takes around 5 full seconds to do the
> > job, and with mine, it takes about 50 ms. Any feedback would be much
> > appreciated, including whether you think this should be included with
> > the form plugin distribution.
> >   
> AFAIK the form plugin pretended to send the form as if it was a normal 
> submit. While I haven't seen a problem with the order yet, I see a 
> problem with this:
> >             $('option', this).each( function() {
> >                 if (this.selected)
> >                     a.push({name: n, value: this.value ||
> > $(this).text()});
> >             });
> >   
> If the user submits a <option value="">Please select...</option>, I want 
> the empty value to be submitted, not the text.
> 
> Apart from that, nice work. I wonder if we could reduce the overall code 
> by merging both seriliaze methods.
> 
> -- Jörn
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to