[thelist] RE: Submitting contents of form only once

Ben Gustafson ben_gustafson at lionbridge.com
Fri Jan 5 16:49:55 CST 2001


Thank you for the suggestion, Tab. I actually came up with a quick and dirty
way to do it, shortly after I submitted my question:

	<script language="Javascript"><!--
	var clicks = 0;
	function countClicks() {
		clicks++;
		if (clicks > 1) {
			alert ("Please click the Submit button only once.");
			return false;
		} else {
			return true;
		}
	}
	//--></script>

...

<form>
	<input type="submit" value="Submit" onClick="return countClicks();">
</form>

--Ben

-----Original Message-----
Message: 18
From: "Tab Alleman" <talleman at autobex.com>
To: <thelist at lists.evolt.org>
Subject: RE: [thelist] Submitting contents of form only once
Date: Fri, 5 Jan 2001 14:50:17 -0500
charset="iso-8859-1"
Reply-To: thelist at lists.evolt.org

I once frequented a website with a login form that often took a while to
process, and when you'd click on the "Submit" button, the text on the button
instantly changed to "Please Wait".  It should be a simple onClick function,
and it was effective.  I never clicked the button twice, because I knew
something was happening... I don't think the script disabled the button,
although that should also be possible, though with spotty browser-support.

Sorry I don't have a script handy, but it should be pretty simple.

HTH

-----Original Message-----
Does anyone know an easy way, using JavaScript and/or ASP, to make a form be
submitted only the first time a user clicks the Submit button? I'm doing a
simple database insert with the contents of a form, and since it's a long
form, users have a tendency to click the Submit button a few times.





More information about the thelist mailing list