This is a half HTML, half Rails questions. I have this form with two buttons at the bottom of the form. One to submit and the other to clear the form. The clear form button does not work, even though at one point I thought it did. My question is can you have two buttons for a form and is my helper right? <%= submit_tag "Clear form", :class => ''inputsubmit'', :type => ''reset'' %> Thanks, ~S -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You cannot have more than one button per form - the action that the form is submitted to is defined in the form tag and has nothing to do with the button. you can the clear form outside the form - perhaps in the form of a link, rather than a button, or you can create a form with just the clear button in. anyway, what I woudl do is post to a ajax function that replaces the form with an empty version of itself if you like javascript you can clear the form without making a call to the server by setting all the form elements''s value to "" On 8/15/07, Shandy Nantz <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > This is a half HTML, half Rails questions. I have this form with two > buttons at the bottom of the form. One to submit and the other to clear > the form. The clear form button does not work, even though at one point > I thought it did. My question is can you have two buttons for a form and > is my helper right? > > <%= submit_tag "Clear form", :class => ''inputsubmit'', :type => ''reset'' > %> > > Thanks, > > ~S > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I just tested your clear form button below and it works fine for me, effectively clearing the form. You can not (automatically) have multiple submit buttons (although this works w/ a tiny bit of javascript), but you definitely can have a submit and a reset button as the reset button does not post back. My guess is that there is something else wrong with your html preventing it from being rendered properly. Have you validated that page using the w3c validator? Ivor Paul wrote:> You cannot have more than one button per form - the action that the > form is submitted to is defined in the form tag and has nothing to do > with the button. > > you can the clear form outside the form - perhaps in the form of a > link, rather than a button, or you can create a form with just the > clear button in. anyway, what I woudl do is post to a ajax function > that replaces the form with an empty version of itself > > if you like javascript you can clear the form without making a call to > the server by setting all the form elements''s value to "" > > On 8/15/07, * Shandy Nantz* <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > <mailto:rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> wrote: > > > This is a half HTML, half Rails questions. I have this form with two > buttons at the bottom of the form. One to submit and the other to > clear > the form. The clear form button does not work, even though at one > point > I thought it did. My question is can you have two buttons for a > form and > is my helper right? > > <%= submit_tag "Clear form", :class => ''inputsubmit'', :type => ''reset'' > %> > > Thanks, > > ~S > -- > Posted via http://www.ruby-forum.com/. > > > > > > >-- Sincerely, William Pratt http://www.billpratt.net billp-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If you just want to reset the form to it''s initial state you could use: <input type="reset" value="Reset Form" /> -jc Ivor Paul wrote:> You cannot have more than one button per form - the action that the > form is submitted to is defined in the form tag and has nothing to do > with the button. > > you can the clear form outside the form - perhaps in the form of a > link, rather than a button, or you can create a form with just the > clear button in. anyway, what I woudl do is post to a ajax function > that replaces the form with an empty version of itself > > if you like javascript you can clear the form without making a call to > the server by setting all the form elements''s value to "" > > On 8/15/07, * Shandy Nantz* <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > <mailto:rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> wrote: > > > This is a half HTML, half Rails questions. I have this form with two > buttons at the bottom of the form. One to submit and the other to > clear > the form. The clear form button does not work, even though at one > point > I thought it did. My question is can you have two buttons for a > form and > is my helper right? > > <%= submit_tag "Clear form", :class => ''inputsubmit'', :type => ''reset'' > %> > > Thanks, > > ~S > -- > Posted via http://www.ruby-forum.com/. > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Correct, and thats exactly what this generates: <%= submit_tag "Clear form", :class => ''inputsubmit'', :type => ''reset'' %> Jesse Clark wrote:> If this email is not spam, click here to submit the signatures to > FortiGuard - AntiSpam Service. > <http://www.nospammer.net/SpamSubmission/SubmitSpam?id=I3QFAH0OY0B9RlBf%0AeE9yQQ__&sig=e340MOQqMpdoIzFtaiVlcHl4NCx2MTNwuXajmA__> > > If you just want to reset the form to it''s initial state you could use: > > > -jc > > Ivor Paul wrote: > > You cannot have more than one button per form - the action that the > > form is submitted to is defined in the form tag and has nothing to do > > with the button. > > > > you can the clear form outside the form - perhaps in the form of a > > link, rather than a button, or you can create a form with just the > > clear button in. anyway, what I woudl do is post to a ajax function > > that replaces the form with an empty version of itself > > > > if you like javascript you can clear the form without making a call to > > the server by setting all the form elements''s value to "" > > > > On 8/15/07, * Shandy Nantz* > wrote: > > > > > > This is a half HTML, half Rails questions. I have this form with two > > buttons at the bottom of the form. One to submit and the other to > > clear > > the form. The clear form button does not work, even though at one > > point > > I thought it did. My question is can you have two buttons for a > > form and > > is my helper right? > > > > <%= submit_tag "Clear form", :class => ''inputsubmit'', :type => ''reset'' > > %> > > > > Thanks, > > > > ~S > > -- > > Posted via http://www.ruby-forum.com/. > > > > > > > > > > > > > > > >-- Sincerely, William Pratt http://www.billpratt.net billp-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have tried both the helper and the notrmal way of writing the html and there is definetly something not working, so I''m going to take Williams advice and validate the form. Thanks everyone for your suggestions, ~S -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---