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?
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 “”
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 P. wrote:
the server by setting all the form elements’s value to “”
I thought it did. My question is can you have two buttons for a
Posted via http://www.ruby-forum.com/.
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,