Skip to content

Instantly share code, notes, and snippets.

@duncanbeevers
Created March 10, 2009 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duncanbeevers/76725 to your computer and use it in GitHub Desktop.
Save duncanbeevers/76725 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Form Submit Test</title>
<script src="http://www.google.com/jsapi"></script>
<script>
// Load prototype
google.load("prototype", "1.6.0.3");
google.setOnLoadCallback(function() {
var form = $('myform'),
original_submit = form.submit;
form.submit = function(event) {
if (form.onsubmit && form.onsubmit()) { original_submit.apply(this, arguments); }
};
});
</script>
</head>
<body>
<form action="#" method="POST" id="myform" onsubmit="alert('form submitted'); return false;">
<input type="submit" name="Submit via input type submit" />
</form>
<button onclick="$('myform').submit()">Submit via javascript</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment