Rails 1.2.3 It appears that the select_year helper doesn''t accept HTML attributes as part of the options array. Does anyone have a way to successfully pass an :onchange attribute in to the select_year helper? I''m going to do it with Javascript directly for now. Thanks, Wes -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Wes, Please could you post the snippet of view code you are using? cheers Jabbslad On Feb 26, 7:32 am, Wes Gamble <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Rails 1.2.3 > > It appears that the select_year helper doesn''t accept HTML attributes as > part of the options array. > > Does anyone have a way to successfully pass an :onchange attribute in to > the select_year helper? > > I''m going to do it with Javascript directly for now. > > Thanks, > Wes > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
Here''s an example: <%= select_year(DateTime.now.year, :start_year => 1960, :end_year => DateTime.now.year, :prefix => "school", :field_name => "yearfrom", :include_blank => true) %> If you read the source code for select_year carefully (api.rubyonrails.org), you''ll see that any regular HTML options do not get passed to the "select_html" call, just option tag values and "select_html" - specific options (which are not HTML options). I ended up using Prototype to set up the onchange handlers dynamically, which, as it turns out, is a better practice, and was actually better suited for what I was doing. Thanks, Wes -- 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 -~----------~----~----~----~------~----~------~--~---