# How to get selection from multiple select list?

**URL:** <https://www.ruby-forum.com/t/how-to-get-selection-from-multiple-select-list/108494>\
**Category:** Rails\
**Created:** [July 4, 2007, 4:01am UTC](https://www.ruby-forum.com/t/how-to-get-selection-from-multiple-select-list/108494 "2007-07-04T04:01:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wpollans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@wpollans](https://www.ruby-forum.com/u/wpollans)\
**Post date:** [July 4, 2007, 4:01am UTC](https://www.ruby-forum.com/t/how-to-get-selection-from-multiple-select-list/108494/1 "2007-07-04T04:01:00Z")

</div>

I have a multiple select list ( with multiple=‘multiple’) in  
one of my view templates.

I can select several items from the list - items with values: 3,4,5.

I can see, using Tamper Data in Firefox, that the selection is being  
returned.  
(POSTDATA=danceselect=3&danceselect=4&danceselect=5&commit=Doit)

‘danceselect’ is the name of listbox.

params[‘danceselect’) contains only one item (‘3’ in this case)

QUESTION: how do I get all of the items selected? Nothing fancy here

- I need the selected items to get info from the DB.

What have I missed?

Thanks,

Warren

---

<div class="post-metadata">

**Author:** ![wpollans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@wpollans](https://www.ruby-forum.com/u/wpollans)\
**Post date:** [July 4, 2007, 6:08am UTC](https://www.ruby-forum.com/t/how-to-get-selection-from-multiple-select-list/108494/2 "2007-07-04T06:08:09Z")

</div>

> params[‘danceselect’) contains only one item (‘3’ in this case)
> 
> QUESTION: how do I get all of the items selected? Nothing fancy here
> 
> - I need the selected items to get info from the DB.
> 
> What have I missed?

Change the name of your select to “danceselect[]”… that is, make sure  
the HTML output looks like this:

\<select name=“danceselect[]”…\>  
…

-philip

---

<div class="post-metadata">

**Author:** ![wpollans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@wpollans](https://www.ruby-forum.com/u/wpollans)\
**Post date:** [July 4, 2007, 4:16pm UTC](https://www.ruby-forum.com/t/how-to-get-selection-from-multiple-select-list/108494/3 "2007-07-04T16:16:16Z")

</div>

thank you very much - I knew it had to be something pretty basic
