Select Multiple - does it work? Help!

I realize that doing a select with multiple must work, yet despite so
many attempts following dozens of examples I have yet to get any
success. I have the following (example) code:

<%= select_tag ‘test[]’, options_for_select([“one”, “two”, “three”],
[“one”]), { :multiple => true, :size =>5, :id => “test” } %>

Note I have the brackets after test - so Rails knows its an array.
When I select one and two in the form I get this:

“test”=>[“two”]

in my log, instead of both entries. What am I doing wrong? This
should be a simple task and I’ve been arguing with it all day.

Here is the syntax for multiple-select:

    <%= select_tag 'categories[]',
        options_for_select( @categories ), { :multiple => true,
                                             :size => 15,
                                             :style  => 

“width:250px” }
%>

It looks like you don’t need the :id parameter. If you select multiple
values, an array with multiple ids will be submitted to the server.

Unfortunately when I do what you’ve got verbatim - I get one parameter
(whatever is the last selected one) sent, as an array.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs