[Rails] Params with multiple values

Eric Anderson eric at afaik.us
Wed Jan 12 21:35:42 GMT 2005


I have a form which contains two checkboxes with the same name. So:

<input type="checkbox" name="foo" value="bar"/>
<input type="checkbox" name="foo" value="baz"/>

When the form submits I attempt to read the values from the submit like

@params['foo']

Only one value is returned even though both are checked. I looked up the 
documentation in the CGI module and it appears that I should be getting 
an array of all values back. Am I missing something here? I know Rails 
does some modifications on CGI to support multi-level parameter names 
(i.e. @params[car][color]) but it seems that multiple values should 
still work.

Thanks for any pointers.

Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://one.textdrive.com/pipermail/rails/attachments/20050112/d462a9cf/signature.bin


More information about the Rails mailing list