Multiple selection in select box in Rhtml

How to select multiple entries in a select box in rhtml ?
In html , it can be done by setting ‘multiple=true’. But in rhtml
‘select-tag’, how to do this ? Pls suggest me !

Hi, you can simply write it in standard HTML.

Good luck,

-Conrad

Very Good Answer ! Any way Thanks!!

Conrad T. wrote:

Hi, you can simply write it in standard HTML.

Good luck,

-Conrad

select_tag(‘letters[]’, options_for_select([‘A’,‘B’,‘C’,‘D’], ‘A’),
:size => 5, :multiple => true)

You need to add the [] to the name to get back an array of selected
values.

On 2/3/06, Saiho Y. [email protected] wrote:

html_options = {“size” => 5, “multiple” => true})


Cody F.
http://www.codyfauser.com

Muruga R. escreveu:

That works great! Thanks!! But what if I need to display the form
with more then one value already selected?
I tried

select_tag(‘letters[]’,
options_for_select([‘A’,‘B’,‘C’,‘D’],‘A’,‘B’), :size =>5, :multiple =>
true)

but that raised the following error: “Wrong number of arguments (3
for 2)”.

Any suggestions?