Click to See Complete Forum and Search --> : running 2 scripts onsubmit?


monster
09-07-2003, 07:05 PM
I use to remember how to do this but I can't see to get it to work. I have two scripts to run onsubmit:

onsubmit="return checkCheckBox(this); onsubmit="validate();return returnVal;""

This isn't working, can anyone remind me what I am doing wrong? These are of course in the right spot in the code. Also they work independently if the other is not there.

dragle
09-08-2003, 09:24 AM
You can string several statements together in your onsubmit, but in this case since you want to check two different things it's probably easier to use a seperate function:

function checkForm(theForm) {
if(checkCheckBox(theForm)) {
validate();
return returnVal;
}
else return false;
}
...
onsubmit="return checkForm(this)";

I don't know where your returnVal comes from, but the above should emulate what you're trying to do. You might also find it easier to just incorporate your CheckBox logic into your validate function, then you would just call validate.

Cheers!