PDA

View Full Version : How bypass form onsubmit when cancel


bam
04-25-2003, 09:24 PM
I have an form onsumbit that validates all required fields before submitting the information to the Action and database insert. But when the user submts a cancel button I want to ignore the validation of required fields and just initiate the cancel process. I am new to this process an not sure how to implement. Any help would be greatly appreciated.

Roy Sinclair
04-25-2003, 10:11 PM
Assuming your cancel button is actually another submit button, the following should do the trick.


<input type="submit" value="Cancel" onclick="this.form.onsubmit=null; return true;" />

tamienne
04-29-2003, 04:01 PM
you could initialize a variable then change the value depending on the button pressed... in your validate routine, check against the variable.