mthompo
Posts: 2
|
Posted: 07/24/2007, 2:23 AM |
|
hi,
am having trouble getting these two functions to work together,
one does the form validation
function EW_checkMyForm(EW_this) {
if (EW_this.x_stockreg && !EW_hasValue(EW_this.x_stockreg, "TEXT" )) {
if (!EW_onError(EW_this, EW_this.x_stockreg, "TEXT", ">Please Enter Car Reg..."))
return false;
}
return true;
}
and this one stops the form from being submitted twice
var submitcount=0;
function submitonce() {
if (submitcount == 0)
{
submitcount++;
return true;
}
else
{
alert("This form has already been submitted. Thanks!");
return false;
}
}
they are run onsubmit of the form
<form action= "custaddmot.asp" name="custaddmot" id="custaddmot" method="post" onSubmit="return EW_checkMyForm(this);return submitonce()">
any ideas appreciated - i am new to javascript
|