What is the rails idiom for submit buttons on forms? All other field types have helpers, but button_to creates its own form, so should not be used. I''ve looked in "Agile Web Dev. with Rails" but can''t see what I should do instead. Is this "difficult" because it runs counter to AJAX type forms? And, related, is there a way to ensure that hitting return in a field does not submit the form? Thank you, Hugh
Hello Hugh ! 2005/11/22, Hugh Sasse <hgs@dmu.ac.uk>:> What is the rails idiom for submit buttons on forms? > All other field types have helpers, but button_to creates its > own form, so should not be used. I've looked in "Agile Web Dev. with > Rails" but can't see what I should do instead.What you're looking for is "submit_tag": http://rubyurl.com/ULX http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html#M000407> And, related, is there a way to ensure that hitting return in a > field does not submit the form?Nope, this is a browser feature. The best you can do is attach a JavaScript event to your fields that prevents Enter from being a submit trigger. I wonder why you'd want to do that, though, as I find this a very important feature for me. Hope that helps ! -- François Beausoleil http://blog.teksol.info/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 11/22/05, Hugh Sasse <hgs-C9usXPTk/FFaa/9Udqfwiw@public.gmane.org> wrote:> What is the rails idiom for submit buttons on forms? > All other field types have helpers, but button_to creates its > own form, so should not be used. I''ve looked in "Agile Web Dev. with > Rails" but can''t see what I should do instead. > > Is this "difficult" because it runs counter to AJAX type forms? > > And, related, is there a way to ensure that hitting return in a > field does not submit the form? > > Thank you, > Hugh<%= submit_tag ''Go'' %> http://rails.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html#M000407 As for hitting return to submit a form... i believe that''s more a function of your browser that does that. -- rick http://techno-weenie.net
On Tue, 22 Nov 2005, Francois Beausoleil wrote:> Hello Hugh ! > > 2005/11/22, Hugh Sasse <hgs-C9usXPTk/FFaa/9Udqfwiw@public.gmane.org>: > > What is the rails idiom for submit buttons on forms? > > All other field types have helpers, but button_to creates its > > own form, so should not be used. I''ve looked in "Agile Web Dev. with > > Rails" but can''t see what I should do instead. > > What you''re looking for is "submit_tag": http://rubyurl.com/ULX > http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html#M000407Thanks (I thanked Rick Olson off list). I see that my local copy of the docs for Actionview is held under the Actionpack directory (in case anyone else can''t see it).> > And, related, is there a way to ensure that hitting return in a > > field does not submit the form? > > Nope, this is a browser feature. The best you can do is attach a > JavaScript event to your fields that prevents Enter from being a > submit trigger. I wonder why you''d want to do that, though, as I find > this a very important feature for me.Because I''m used to using a shell, and often hit return by habit to get to the next line.> Hope that helps ! > -- > Franois Beausoleil > http://blog.teksol.info/ >Hugh _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails