Forum Moderators: open
I added:
this.onclick = new Function('return false');
to the onclick handler in the button:
<input type="submit" name="submit" onclick="this.onclick = new Function('return false');">
Which will submit the form and at the same time "turn off" the button or submit image from further clicking without disabling it as an INPUT upon processing of the form POST/GET.
Reason I opted for not having a disabled=true, is because in my testing, this also stopped the submit process dead in its tracks. Also, if it did work, it still wouldn't work in Dreamweaver which depends on "submit" to have a value (yes, the button itself is evaluated to determine that the form was submitted on that pass of calling the script).
Any other brilliant solutions? Does this work in other browsers?
Here's my test:
<script>
function submitit() {
document.forms[0].txt.value += "submitted\n";
document.forms[0].fld.focus();
document.forms[0].onsubmit = new Function('return false');
return false;
}
</script><form onsubmit="return submitit();">
<textarea name="txt"></textarea>
<input name="fld" type="text">
<input type="submit" onclick="this.onclick = new Function('return false');">
</form>
But in practice, only this will be needed:
<form onsubmit="new Function('return false');">
Thanks for your participation!