Hi, i just want to create with Ror an event when a the mouse is over an element. Is there any helper function like link_to_remote that generates the code.... I need something like this <div onMouseOver="<%= function_i_need ''div_i_want_to_update'', :url=>{:action=>''list''} %>" > Some text </div> Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
cfingerh, > i just want to create with Ror an event when a the mouse is over an > element. Is there any helper function like link_to_remote that > generates the code.... You are close: look at ''link_to_remote'' source http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005056 , and you''ll see that it calls ''remote function'' http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005063 In the view : ------------------ <a onmouseover="<%= remote_function(:url => { :action => :bar }) %>" >foo</a> In the controller: ------------------ def bar render(:update) { |page| page.alert(''bar'') } end Alain ---- blog.ravet.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 -~----------~----~----~----~------~----~------~--~---
When would doing something like that be useful or better than just embedding the javascript? Maybe if the stuff that you''d be mousing over was dynamic rather than static? Just curious. On 5/10/07, Alain Ravet <alain.ravet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > cfingerh, > > i just want to create with Ror an event when a the mouse is over an > > element. Is there any helper function like link_to_remote that > > generates the code.... > > > You are close: look at ''link_to_remote'' source > > http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005056 > , and you''ll see that it calls ''remote function'' > > http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005063 > > > In the view : > ------------------ > > <a onmouseover="<%= remote_function(:url => { :action => :bar }) %>" > >foo</a> > > > In the controller: > ------------------ > def bar > render(:update) { |page| > page.alert(''bar'') > } > end > > > > > Alain > ---- > blog.ravet.com > > > >-- Terry (TAD) Donaghe http://tadspot.tumblr.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 -~----------~----~----~----~------~----~------~--~---