Prototype Form.serialize and mutli selects

Morus Walter
2005-12-09T07:14:21Z

Hi,

[I asked this on the rails.spinoff list beginning of the week without an
answer. I''m not sure what''s the right place to ask questions
about rails
and prototype so I''ll try again here.]

I ran into a problem when using a multi select list in a form
submitted through ajax.

The name of the select element is something like foo[].
When multiple entries are selected the browser creates form data like
foo[]=1&foo[]=2&foo[]=4 (url encoded of course).
Rails then creates an array ["1","2","4"] for
foo''s entry in the
parameter hash.

Prototype OTOH creates form data like
foo[]=1,2,4
which isn''t recognized by rails as multiple values and I end up with an
array ["1,2,4"] in the parameter hash, which does not work for
updating
a habtm relationship.

Should this be considered a bug in prototype (Form.serialize should work
the same way the browser works)? Or is it a rails problem?

Morus