[thelist] Submitting contents of form only once

Jon Hall jonhall at ozline.net
Fri Jan 5 15:26:11 CST 2001


Easiest but not foolproof is just to change the text of the button after
they have submitted :-)
 <INPUT TYPE="Button" NAME="Submit" VALUE="Submit"
onClick="if(this.value == 'Submit') this.form.submit(); this.value =
'Please Wait.';">

This only works in new browsers though
In your head put this
<script>
function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset"
)
//disable em
tempobj.disabled=true
}
}
}
</script>

call it like so..
<form method="POST" onSubmit="submitonce(this)">

jon

----- Original Message -----
From: "Ben Gustafson" <ben_gustafson at lionbridge.com>
To: <thelist at lists.evolt.org>
Sent: Friday, January 05, 2001 2:22 PM
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