Never assume that you can undo the submit button, instead set some javascript variable or hidden field in the form and use onsubmit. Take my word for it. Ask onsubmit to view the variable set by the various submit buttons
Never use javascript: (javascript colon) if you are not in IE and have VBScript as the first script on the page. In all other cases, javascript is the default.
Never use atrocities like <a href="javascript:something()" instead of <a href="#" onclick="return something()
Finally, in IE, when you encounter an error, the default action is to submit the form. Perhaps you may well have other errors elsewhere, and confirmation will return an error that is considered true (0 evaluates to false, most of the rest is true )
<script type="text/javascript"> var isvalidateNeeded = true; function validate(theForm) { if (!isvalidateNeeded) return true; </script> <form onsubmit="return validate(this)"> . . . <input type="submit" name="subaction" value="Test" onclick="isvalidateNeeded=false" /> <input type="submit" name="subaction" value="Check" onclick="isvalidateNeeded=false" /> <input type="submit" name="subaction" value="Submit" onclick="isvalidateNeeded=true" /> </form>
source share