Re: disabling the submit button

by "Steve Mount" <steve(at)saltyrain.com>

 Date:  Tue, 9 Oct 2001 20:54:27 -0400
 To:  "Davies,
Elizabeth H." <EHDavies(at)West.com>,
"HWG-technique Mailing List \(E-mail\)" <hwg-techniques(at)hwg.org>
 References:  wtc
  todo: View Thread, Original
It is possible, with JavaScript.  Of course, the user has to be using a JS
browser and it has to be turned on ... but that may be the bulk of your
users.
Here's an example (I wrote this quickly, so be sure to test it yourself; and
be sure to remove the .'s where necessary):

<.html>
<.head>
<.title>Title<./title>
<.script language="JavaScript" type="text/javascript">
<.!-- Hiding!

var alreadySubmitted = 0;

function validateSubmit()
{
  if (alreadySubmitted == 1) return false;
  alreadySubmitted = 1;
  return true;
}

// End hiding -->
<./script>
<./head>
<.body>

<.form onSubmit="return validateSubmit();" action="urlhere" method="GET">
... form widgets here ...
<.input type=submit value="Submit">
<./form>

<./body>
<./html>


-------------------------------------------------------------
Steve Mount, Software Engineer            steve(at)saltyrain.com
Home Site                            http://www.saltyrain.com
US Constitution Online          http://www.usconstitution.net
Free Your Soul             http://www.anonymousconfession.com


----- Original Message -----
From: "Davies, Elizabeth H." <EHDavies(at)West.com>
To: "HWG-technique Mailing List (E-mail)" <hwg-techniques(at)hwg.org>
Sent: Tuesday, October 09, 2001 4:46 PM
Subject: disabling the submit button


> Is it possible to disable a submit button after it's been hit once?
>
> We have a few people who have itchy trigger fingers and keep double or
> triple banging and creating duplicate database entries......
>
> Elizabeth Davies
> Web Designer
> West Corporation
> (402)573-3386 or X206-7562

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA