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 -- Posted via http://www.ruby-forum.com/.
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 Ross http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby
Philip Ross 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 Ross > http://tzinfo.rubyforge.org/ -- DST-aware timezone library for RubyThank you. That worked. -- Posted via http://www.ruby-forum.com/.
Thanks. This saved me today :( -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---