Rails 3, How do I set an :onload for a link_to :remote?

With Rails 2 on a link_to_remote, I could set :onload, :oncomplete and
other options. How do I handle those with Rails 3 since those options
are no longer available? (I could go and use the legacy plugin, but
I’d like to avoid that if possible.)

Rails 3 has a more unobtrusive approach and all i s done from external

Can you tell me exactly how I would go about doing this? Code sample
perhaps. Or any resources that have that information?

I already know about the changes to remove the legacy link_to_remote
and other remote helpers, but I haven’t found any resources that tell
me more details on how to fully use the replacement. It’s like
upgrading getting a new electric car, but not knowing how to use the

The main features that I’d like to figure out how to do again
are :onload and :condition.

I’m using Prototype. I mainly want to use the equivalent of :onload
to show a processing graphic, and :condition to check the value in an
input field to see if a request should be sent off to the server.

Can anybody provide code/samples/details on how to do this?

On Sun, Oct 3, 2010 at 1:37 PM, Jim [email protected] wrote:

are :onload and :condition.

The reason you dont find much info is because this now falls in the
realm of
javascript and has almost nothing to do with rails.
Is like looking for info on how to style something or how to build a sql
query, is no longer a rails issue. But anyway, i sure can help you but
i need to know what library you are using, go to /public/javascripts
and tell me if there is a prototype.js or a jquery.js there.

i have an example app that uses unobstrusive javascript but is running
jquery, take a look and ask any questions you want.

I had this same question. I found a good answer here:

good luck