Click to See Complete Forum and Search --> : Can I have multiple onsubmit functions?


mcbride
12-11-2003, 10:51 AM
I'm trying to run some scripts that do multiple things to a form. It currently highlights the selected text box, does a form check to be sure that all fields have data entered. I want to add another onsubmit function to validate that their is a valid email entered in the email field. How do I add multiple onsubmits. Right now I have the following code:
onsubmit="return formCheck (this)". I'd like to add:
onsubmit="return emailCheck ()". I already have the proper scripts in the <head>. They work independently but I want to have them both, how do I do this. Thanks in advance.

MichaelM
12-11-2003, 10:56 AM
call emailCheck() from within the formCheck() function. Somthing like:

function formCheck(frm) {
...
return emailCheck()
}

function emailCheck() {
...
if(something) {
return true;
} else {
return false;
}
}