Forum: Ruby on Rails form_remote_tag : additional onsubmit funct. possible ?

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.
Af1ee2208795752559b049502ded660c?d=identicon&s=25 Andrew Cowan (k2mia)
on 2006-04-10 18:19
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:

<div id="form_container">

<%= form_remote_tag :url => { :action => 'do_stuff', :id => @stuff.id }
%>
<%= hidden_field_tag "info", @info %>
<%= text_field_tag "input_here", "0", :size => '5' %>
<input type="submit" value="DO_STUFF">
</form>

</div>

---


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
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Kevin Olbrich (Guest)
on 2006-04-10 18:34
(Received via mailing list)
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 Cowan wrote:
>
>
>Posted via http://www.ruby-forum.com/.
>_______________________________________________
>Rails mailing list
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails


_Kevin
41e1579600683eed6c00af9a425268e6?d=identicon&s=25 Edward Frederick (Guest)
on 2006-04-10 18:37
(Received via mailing list)
Andrew,

Try:

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


--

Ed Frederick -- edwardfrederick.com
Af1ee2208795752559b049502ded660c?d=identicon&s=25 Andrew Cowan (k2mia)
on 2006-04-10 18:50
Thanks guys, looks like that should do ther trick.

Much appreciated!
Andy


Edward Frederick wrote:
> Andrew,
>
> Try:
>
>> <%= form_remote_tag :url => { :action => 'do_stuff', :id => @stuff.id }, :loading => 
'somefunc();' %>
>
>
> --
>
> Ed Frederick -- edwardfrederick.com
This topic is locked and can not be replied to.