You are here: irt.org | FAQ | JavaScript | Form | Q1279 [ previous next ]
Block the submit behaviour in the form, and activate it with the onClick handler:
Javascript code
<script language="javascript">
function submitForm ()
{
document.myForm.onsubmit = function onSubmit(event) { return true; };
// note that the 1st onsubmit is all in lowercase
}
</script>
Form code
<form name="myForm" method=post action="/foo/bar.pm" onSubmit="return false;">
<input type="text" name="some_text">
<input type="submit" value="Submit" onClick="submitForm()">
</form>Submitted by Frederic Hurtubise