Submit Once- Form Validation Javascript Rumi, July 23, 2008 If you have forms on your site, you know they are extremely prone to abuse by users. Apart from incomplete or bogus entries, the most common offense is duplicate submissions by the same individual, caused by pressing the “Submit” button over and over and over again. Well, this DHTML script has a cure for the problem, by allowing you to disable the submit (and reset) button once it is pressed once. Note that the disabling effect is applied only to IE 4+ and NS 6+ browsers. All other browsers will still be able to sneak by and submit the form (degrades well). Also, the disabled buttons can easily be resurrected by reloading the page. Step1: Insert the below validation code into the <head> of your page: <script> /* Submit Once form validation- © Dynamic Drive (www.dynamicdrive.com) For full source code, usage terms, and 100’s more DHTML scripts, visit http://dynamicdrive.com */ function submitonce(theform){ //if IE 4+ or NS 6+ if (document.all||document.getElementById){ //screen thru every element in the form, and hunt down “submit” and “reset” for (i=0;i<theform.length;i++){ var tempobj=theform.elements[i] if(tempobj.type.toLowerCase()==”submit”||tempobj.type.toLowerCase()==”reset”) //disable em tempobj.disabled=true } } } </script> Step-2 Inside the form in question, add the part in red to the <FORM> tag, as follows: <form method=”POST” onSubmit=”submitonce(this)”> Scripts