Gossamer Forum
Home : General : Internet Technologies :

Neat one-click Submit javascript...helps prevent multiple submit clicks

Quote Reply
Neat one-click Submit javascript...helps prevent multiple submit clicks
Hi All

I just came across this one. It helps to prevent multiple submits of the same form:

http://www.scriptbreaker.com/examples/disable.asp

The zip file doesn't include the alert, but if you look on the demo page, you can see where to insert an alert. It's good to have the alert so that your users understand that they have to wait for the form to be processed.

Cheers! Smile

------------------------------------------
Quote Reply
Re: [DogTags] Neat one-click Submit javascript...helps prevent multiple submit clicks In reply to
That seems to be becoming more popular nowadays, I see paypal use it on almost all of their forms.
Quote Reply
Re: [DogTags] Neat one-click Submit javascript...helps prevent multiple submit clicks In reply to
Heres another one:
Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
var submitcount=0;

function submitOnce (form) {

if (submitcount == 0)
{
submitcount++;
return true;
}
else
{
alert("This form has already been submitted. Thanks!");
return false;
}

}
//-->
</SCRIPT>
</HEAD>

<BODY>
<FORM METHOD=POST ACTION="some.cgi" onSubmit="return submitOnce(this)">
<INPUT TYPE="SUBMIT" NAME="" VALUE="submit it">
</FORM>
</BODY>
</HTML>

chmod

Last edited by:

chmod: Oct 23, 2002, 7:00 AM