Html_options and select()

I am trying to add html_options to select():
<%=select(:user, :id,[[‘me’,1],[‘myself’,2],[‘and I’,3]], :select =>
{},:html_options => {“size” => 5, “multiple” => true})%>

This does not work… How do I get the html_options to work?

ActionView::Helpers::FormOptionsHelper

Chris McDevitt wrote:

I am trying to add html_options to select():
<%=select(:user, :id,[[‘me’,1],[‘myself’,2],[‘and I’,3]], :select =>
{},:html_options => {“size” => 5, “multiple” => true})%>

This does not work… How do I get the html_options to work?

Try the following:

<%=select(:user, :id,[[‘me’,1],[‘myself’,2],[‘and I’,3]], {},
{“size” => 5, “multiple” => true})%>

options and html_options are two separate hash parameters. The syntax
you were using would have passed the following hash as options and left
html_options empty:

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


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby

Philip R. wrote:

<%=select(:user, :id,[[‘me’,1],[‘myself’,2],[‘and I’,3]], {},
{“size” => 5, “multiple” => true})%>

options and html_options are two separate hash parameters. The syntax
you were using would have passed the following hash as options and left
html_options empty:

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


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby

Thank you. That worked.

Thanks. This saved me today :frowning: