Andrew Cowan
2006-Apr-10 16:19 UTC
[Rails] 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: <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 -- Posted via http://www.ruby-forum.com/.
Kevin Olbrich
2006-Apr-10 16:31 UTC
[Rails] form_remote_tag : additional onsubmit funct. possible ?
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:> >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 > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails_Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
Edward Frederick
2006-Apr-10 16:34 UTC
[Rails] form_remote_tag : additional onsubmit funct. possible ?
Andrew, Try:> <%= form_remote_tag :url => { :action => ''do_stuff'', :id => @stuff.id }, :loading => ''somefunc();'' %>-- Ed Frederick -- edwardfrederick.com On 4/10/06, Andrew Cowan <icculus@gmdstudios.com> wrote:> > 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Andrew Cowan
2006-Apr-10 16:51 UTC
[Rails] Re: form_remote_tag : additional onsubmit funct. possible ?
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-- Posted via http://www.ruby-forum.com/.