Link_to_remote for a div


#1

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

Some text

Thanks


#2

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

In the controller:

def bar
render(:update) { |page|
page.alert(‘bar’)
}
end

Alain

blog.ravet.com


#3

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/PrototypeHelper.html#M005056

Alain

blog.ravet.com


Terry (TAD) Donaghe