Form.serialize for multiple selects broken in 1.7.0.0?

91 views
Skip to first unread message

Jeff Emminger

unread,
May 3, 2012, 3:25:24 PM5/3/12
to prototype-s...@googlegroups.com
When using v1.6.0.2 and serializing a form with a "multiple" select list, I would get its value like "&myselect[]=foo&myselect[]=bar".

In v1.7.0.0 it's posting the value like "&myselect[]=foo,bar".  This does not work properly on the backend (Rails).

Is this expected behavior?  Attached are test pages.
select.1.6.0.2.html
select.1.7.0.0.html

Miguel Beltran R.

unread,
May 7, 2012, 3:54:49 PM5/7/12
to prototype-s...@googlegroups.com


2012/5/3 Jeff Emminger <jemm...@gmail.com>

When using v1.6.0.2 and serializing a form with a "multiple" select list, I would get its value like "&myselect[]=foo&myselect[]=bar".

In v1.7.0.0 it's posting the value like "&myselect[]=foo,bar".  This does not work properly on the backend (Rails).

Is this expected behavior?  Attached are test pages.


I don't find anything about this behavior, except


http://www.w3.org/MarkUp/html-spec/html-spec_2.html#GLOSS17
form data set
a sequence of name/value pairs; the names are given by an HTML document and the values are given by a user.

http://lists.w3.org/Archives/Public/ietf-http-wg/2012JanMar/0081.html
> > >The spec doesn't seem to speak suggested/valid combinations of verbs and
> > >query parameters (please point me to the location if I've missed it).
> >
> > No, it does not.

http://tools.ietf.org/html/rfc2396#section-3.4
Within a query component, the characters ";", "/", "?", ":", "@",
   "&", "=", "+", ",", and "$" are reserved.

It looks like every user-agent can do it in diferents ways
--
________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida

Victor

unread,
Jun 28, 2012, 11:03:20 AM6/28/12
to prototype-s...@googlegroups.com
When using v1.6.0.2 and serializing a form with a "multiple" select list, I would get its value like "&myselect[]=foo&myselect[]=bar".
In v1.7.0.0 it's posting the value like "&myselect[]=foo,bar".  This does not work properly on the backend (Rails).
Is this expected behavior?

Yes, Prototype 1.7 serializes select-multiple in this way (comma-separated), because this is how String.interpret() and encodeURIComponent() work for arrays of values retrieved from select element, although browsers natively serialize exactly as Prototype 1.6 - each value separately.

Cry aloud - maybe developer will revert this back to more browser-compatible way.
Reply all
Reply to author
Forward
0 new messages