# How to implement multiple select box?

**URL:** <https://www.ruby-forum.com/t/how-to-implement-multiple-select-box/137220>\
**Category:** Rails\
**Created:** [May 10, 2008, 9:13am UTC](https://www.ruby-forum.com/t/how-to-implement-multiple-select-box/137220 "2008-05-10T09:13:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [May 10, 2008, 9:13am UTC](https://www.ruby-forum.com/t/how-to-implement-multiple-select-box/137220/1 "2008-05-10T09:13:13Z")

</div>

Hi all…

I have to use a select box with multiple selection capability. Also i  
have to retrieve the selected items from the controller.

I used select\_tag. But while retrieving the value i don’t get anything  
in the controller

Please help.

Thanks  
Suneeta

---

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [May 10, 2008, 2:49pm UTC](https://www.ruby-forum.com/t/how-to-implement-multiple-select-box/137220/2 "2008-05-10T14:49:58Z")

</div>

It works fine for me.

On Sat, May 10, 2008 at 3:13 AM, Suneeta Km \<  
removed\_email\_address@domain.invalid\> wrote:

> ## Thanks Suneeta
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
James M.

---

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [May 10, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/how-to-implement-multiple-select-box/137220/3 "2008-05-10T16:44:50Z")

</div>

Suneeta Km wrote:

> I have to use a select box with multiple selection capability. Also i  
> have to retrieve the selected items from the controller.
> 
> I used select\_tag. But while retrieving the value i don’t get anything  
> in the controller

The two tricks are…

select\_tag ‘my\_records[]’, … :multiple =\> :multiple

The [] is a trick that helps a form pass an array of results, and your  
  
HTML needs the multiple=“multiple” attribute.

Post your code if you get stuck!

–  
Phlip
