Multiple selection in select box in Rhtml


#1

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 !


#2

Hi, you can simply write it in standard HTML.

Good luck,

-Conrad


#3

Very Good Answer ! Any way Thanks!!

Conrad T. wrote:

Hi, you can simply write it in standard HTML.

Good luck,

-Conrad


#4

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. removed_email_address@domain.invalid wrote:

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


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

Muruga R. escreveu:


#5

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?