How to Handle more than one submit button in single form?


Posted on 16th Feb 2014 07:03 pm by admin

Hi
I have one PHP file which contains one Form. In this form there are two Submit type Buttons
<input type="submit" name="edit" value="save">
<input type="submit" name="cancel" value="cancel">
<form name="myform" onsubmit="return validate()">

My problem is : When i m trying to use Javascript onsubmit event of a form it confused due to two submit buttons and onsubmit of any button(save or cancel) it runs Javascript. Generally it should not run on cancel button.

Please provide solution as soon as possible.

thanks

No comments posted yet

Your Answer:

Login to answer
243 Like 44 Dislike
Previous forums Next forums
Other forums

Parse error: syntax error, unexpected $end in
hello,
i receive the error :Parse error: syntax error, unexpected $end in C:xamppxampphtdocsh

DateTimeZone::listIdentifiers headache
http://php.net/manual/en/datetimezone.listidentifiers.php


So the documentation states tha

BackButton Behaviour in AJAX
I have an ASPX Page AJAX Enabled!The page has a gridView and a DDL for filtering on it. The Gridview

Had a simple form script that suddenly stopped working
It was made about a year ago and had been working fine. Last time it was known to work for sure was

Help If user voted, block them
On my Prayer request site, i let users Click a button to Pray for somone that has posted a pray, i g

PHP Game
hy i was wondering what's the best method in order to make some automatic updates in a php game
<

Simple Variable Question
Hi everyone.... again,

I am really getting into php still. Learning more every day. I love it

Ten Operator Syntax
Hi Guys,

I can't figure out why i am getting a parse error with this basic ten op code:

natcasesort works on one server but not on another
Hi

I have a problem that I was hoping that someone can help me with.

I'm trying to use

Recording popularity by day, week.. all time?
Hey everyone, I'm creating a site designed around users uploading music. How can I implement a syste

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash