HTML Forms


#1

Hello,
I have a form with two buttons - [1] Create [2] Cancel. By default if a
user
clicks on any of them, the form gets submitted. However, I dont want to
do
that. I want to call a javascript function on cancel and form submit (as
usual) on create. How can this be achieved?


Thanks,
Jaikishan


#2

Well where do you want the cancel button to go ? reset the form and
back to the new task? or some other page?

Just use a link_to or button_to for the cancel button… Don’t make it
part of the form…


#3

On Fri, Oct 24, 2008 at 1:05 PM, Jaikishan J. removed_email_address@domain.invalid
wrote:

I have a form with two buttons - [1] Create [2] Cancel. By default if a user
clicks on any of them, the form gets submitted.

So why is ‘Cancel’ a submit button? Make it a reset button and attach
your handler to it.


Hassan S. ------------------------ removed_email_address@domain.invalid