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 ).

example:

<%= form_remote_tag :url => { :action => ‘do_stuff’, :id => @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.
-Andy

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 http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

_Kevin

Andrew,

Try:

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

Ed Frederick – edwardfrederick.com

Thanks guys, looks like that should do ther trick.

Much appreciated!
Andy

Edward F. wrote:

Andrew,

Try:

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

Ed Frederick – edwardfrederick.com