[thelist] Submitting contents of form only once

Joshua OIson joshua at alphashop.net
Fri Jan 5 14:27:11 CST 2001


The easiest way (and maybe only way) would be to make changes such as the
following:

<script lang...>
  var submitted = false;
  function check_submit()
  {
     if (submitted) return false;
     return (submitted = true);
     // only one equal sign because it's being set too
  }
</script>

<form method="..." action="..." onsubmit="return check_submit();">
  <input type="submit">
</form>

To protect yourself on the server side you might think about including a uid
in a hidden form field that gets recorded somewhere (session variable and/or
with the record) and then you can do a quick check to make sure the request
not already been processed before continuing.

Hopefully that helps.

-joshua

----- Original Message -----
From: "Ben Gustafson" <ben_gustafson at lionbridge.com>
To: <thelist at lists.evolt.org>
Sent: Friday, January 05, 2001 11:22 AM
Subject: [thelist] Submitting contents of form only once


> 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.
>
> Thanks in advance for your help,
>
> --Ben Gustafson
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list