Forum: Ruby on Rails link_to_remote for a div

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
cfingerh (Guest)
on 2007-05-10 22:35
(Received via mailing list)
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
Alain R. (Guest)
on 2007-05-10 23:31
(Received via mailing list)
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/Pro...
, and you'll see that it calls 'remote function'
   http://caboo.se/doc/classes/ActionView/Helpers/Pro...


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 D. (Guest)
on 2007-05-11 01:57
(Received via mailing list)
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 R. <removed_email_address@domain.invalid> wrote:
> http://caboo.se/doc/classes/ActionView/Helpers/Pro...
>
>
>
> Alain
> ----
> blog.ravet.com
>
> >
>


--
Terry (TAD) Donaghe
http://tadspot.tumblr.com
This topic is locked and can not be replied to.