Form_remote_tag : additional onsubmit funct. possible?


Is there a way to add onsubmit functionality to a form_remote_tag with
an additional javascript directive?

eg I’d like for an inline javascript to make the form’s div container
hidden as soon as the button is pressed to avoid having it possibly get
pressed again ( sometimes the rails response is slow enough for a user
to think they need to re-press it ).


<%= form_remote_tag :url => { :action => ‘do_stuff’, :id => }
<%= hidden_field_tag “info”, @info %>
<%= text_field_tag “input_here”, “0”, :size => ‘5’ %>

How would I modify the above ( if possible ) to add javascript to set
form_container to hide?

Thank You for any suggestions you can offer.


I’m not certain on this one, but I would wager that form_remote_tag
calls remote_function() at some point.

Try passing it a callback option like :before=>‘some javascript’.

On Monday, April 10, 2006, at 6:19 PM, Andrew C. wrote:

Posted via

Rails mailing list





<%= form_remote_tag :url => { :action => ‘do_stuff’, :id => }, :loading => ‘somefunc();’ %>

Ed Frederick –


Thanks guys, looks like that should do ther trick.

Much appreciated!

Edward F. wrote:



<%= form_remote_tag :url => { :action => ‘do_stuff’, :id => }, :loading => ‘somefunc();’ %>

Ed Frederick –