Forum Moderators: phranque
I'm looking for a certain kind of button, (I've seen it before so I know it exists... somewhere!) that just doesn't allow you to click more than once, so it would make it impossible to get double orders/cc payments...
But, thats an nice bit of code, thanks... :)
Here's something I found that does the trick. Requires modification.
<!-- This goes in the head -->
<SCRIPT LANGUAGE="JavaScript">
var submitcount=0;
function reset() {
document.yourform.formdata1.value="";
document.yourform.formdata2.value="";
document.yourform.formdata3.value="";
}
function checkFields() {
if ( (document.yourform.formdata1.value=="") ¦¦ (document.yourform.formdata2.value=="") ¦¦ (document.yourform.formdata3.value=="") )
{
alert("Error: Your didn't fill out the form.");
return false;
}
else
{
if (submitcount == 0)
{
submitcount++;
return true;
}
else
{
alert("This form has already been submitted.");
return false;
}
}
}
// End -->
</script>
<!-- Make sure you do the onLoad handler in the body tag -->
<BODY OnLoad="reset()">
<!-- Here's the form itself -->
<form method=post action="responsepage.asp" name="yourform" onSubmit="return checkFields()">
<input type=text name="formdata1">
<input type=text name="formdata2">
<input type=text name="formdata3">
<input type=submit value="Submit Form">
</form>
T