rails and rails only wrote:
> <%=select_year(Date.today,:include_blank=>true, :start_year =>
> Date.today.strftime("%Y").to_i, :end_year => 1999)%>
>
> i am using rhis helper... now i want to give onchange here....
If you check out the api:
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M001489
select_year(date, options = {}, html_options = {})
So to add an onchange you need to use the html_options hash...
<%=select_year(Date.today,{:include_blank=>true, :start_year =>
Date.today.strftime("%Y").to_i, :end_year => 1999}, {:onchange =>
'myjsfunction();'})%>
Note the curly braces. Ruby is pretty clever in that it will convert
the last set of symbols into a hash which is pretty helpful but not if
you want be able to send the html_options hash. However if you
specifically mark the hashes (i.e. put curly braces around them) you can
send both hashes.
Cheers
Luke
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---