Really you can not completely disable the form, but you can stop the accidental resubmission if the user's browser has JavaScript enabled. This example will also disable the radio buttons as some people ask how to disable form fields as well as the submit button. This will not interfere with form submission, just minimize the chance of a double click. [
Better way - Cross Browser]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005, 2006 Roderick Divilbiss">
<script type="text/javascript">
<!--
function spButtonClick() {
document.getElementById('R1a').disabled=true;
document.getElementById('R1b').disabled=true;
document.getElementById('B1').value=' Please Wait... ';
document.getElementById('B1').disabled=true;
}
//-->
</script>
<title>rodsdot.com :: disable the submit button on form submit</title>
</head>
<body>
<script type="text/javascript">
document.write('<input type="button" value="Submit and Disable" name="B1" onclick="spButtonClick();">');
</script>
<noscript>
<input type="button" value="Submit (Can't Disable)" name="B1">
</noscript>
<input id="R1a" type="radio" value="1" name="R1" checked> Yes
<input id="R1b" type="radio" value="2" name="R1"> No
</body>
</html>
© Coyright 2000-2008, Roderick (Rod) W. Divilbiss. Some rights reserved.
Except where otherwise noted, this site, all content, and all source code and markup is licensed under a Creative Commons License
Creative Commons License.
No part of this web site including all application code and examples may be used for commercial purposes without prior written permission from the author,
Roderick W. Divilbiss of Overland Park, Kansas, United States of America.