# Select Multiple - does it work? Help!

**URL:** <https://discuss.rubyonrails.org/t/select-multiple-does-it-work-help/21863>\
**Category:** rubyonrails-talk\
**Created:** [December 17, 2007, 8:38pm UTC](https://discuss.rubyonrails.org/t/select-multiple-does-it-work-help/21863 "2007-12-17T20:38:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![esmith](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@esmith](https://discuss.rubyonrails.org/u/esmith)\
**Post date:** [December 17, 2007, 8:38pm UTC](https://discuss.rubyonrails.org/t/select-multiple-does-it-work-help/21863/1 "2007-12-17T20:38:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Bala\_Paranj](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@Bala\_Paranj](https://discuss.rubyonrails.org/u/Bala_Paranj)\
**Post date:** [December 17, 2007, 9:36pm UTC](https://discuss.rubyonrails.org/t/select-multiple-does-it-work-help/21863/2 "2007-12-17T21:36:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![esmith](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@esmith](https://discuss.rubyonrails.org/u/esmith)\
**Post date:** [December 17, 2007, 10:35pm UTC](https://discuss.rubyonrails.org/t/select-multiple-does-it-work-help/21863/3 "2007-12-17T22:35:09Z")

</div>

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