Click to See Complete Forum and Search --> : onClick funcion order


CurGeorge8
07-09-2003, 02:32 PM
OK, I'm using the onClick command to do two seperate commands.

First it runs check(this form) which runs function check() in the header to verify that all the required fields have a value.

Then it runs value="Processing Form..."; to change the name of the button so people don't click it multiple times.

The problem is that if there is a problem in the function check that requires the user to change, it still changes the value of the button to "Processing Form"

How can I up the button to change to "Processing Form" ONLY after the function check is complete?

Thanks
~~Dan

CurGeorge8
07-09-2003, 02:35 PM
P.S. - Here's the code I'm using in the onClick for the Submit button:
check(this.form);
value="Processing Form...";
and here's the code in the function check.
function check()
{
form = document.forms[0]

if ( document.forms[0].ContactName.value=="") {
alert("Please enter your name")
document.forms[0].ContactName.focus()
return
}

if ( document.forms[0].Email.value=="") {
alert("Please enter your E-mail address");
document.forms[0].Email.focus();
return;
}

if ( document.forms[0].Department.value=="") {
alert("Please enter your department");
document.forms[0].Department.focus();
return;
}

if ( document.forms[0].Phone.value=="") {
alert("Please enter your Phone Number");
document.forms[0].Phone.focus();
return;
}

document.forms[0].submit()
}
Thanks for your help. This site is being developed for an intranet, so I cannot provide the URL.

~~Dan