How can I disable a form submit button so that it can't be hit twice in quick succession to submit a form?

RamMohan Pratap

It is quite simple to do that. Just call a JavaScript function on clicking the submit button to disable the submit button. So you cannot click it the next time . Here is the sample code to do that. Hope this helps. Be sure to have an action to submit the form to...


<body>
<form name="form1">
<input type="text" name="txtbox" value="Dummy">
<input type="Submit" name="SubmitButton" 
  onClick="form1.SubmitButton.disabled=true;">
</form>
</body>

You can also use something like the following too, which should work across browsers:

var clickonce = false;
function js_save()
{
	if(clickonce==false)
	{
		document.formTrial.submit();
		clickonce=true;
	}
}
Call this method on the onclick event of the HREF or Button.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact