Forum: Ruby on Rails select box with multiple rows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Michael Whitman (Guest)
on 2006-04-22 00:49
(Received via mailing list)
I want a select box that displays 5 rows instead of one row and a drop
down.
so i figure this should work, but it doesn't.

<%= collection_select(:constellation, :region_id, @regions, :id, :name,
html_options = {:size => '5'})%>

I am not quite sure how to use that html_options and googling around I
didnt
find anything directly on point.

Any suggestions?

Thanks,

Mike
**
**
Alex W. (Guest)
on 2006-04-22 05:11
Michael Whitman wrote:
> I want a select box that displays 5 rows instead of one row and a drop
> down.
> so i figure this should work, but it doesn't.
>
> <%= collection_select(:constellation, :region_id, @regions, :id, :name,
> html_options = {:size => '5'})%>
>
> I am not quite sure how to use that html_options and googling around I
> didnt
> find anything directly on point.
>
> Any suggestions?
>
> Thanks,
>
> Mike
> **
> **

Try

collection_select(
  :constellation,
  :region_id,
  @regions,
  :id,
  :name,
  nil,
  {
    :multiple => true,
    :size     => 5
  }
)
This topic is locked and can not be replied to.