View Full Version : Multiple onSubmit's?

Reno CF
05-11-2007, 02:20 AM
Is it possible to run two onSubmit's in the same form action?

[1] onSubmit="return function1(this.formname.value);"

[2] onSubmit="return function2();"

If so, would it be like this:

onSubmit="return function1(this.formname.value); return function2();"

or like this?:

onSubmit="return function1(this.formname.value); function2();"

or something else entirely?

Thanks for any guidance!

05-11-2007, 02:30 AM
If you want both functions to have to return true for the submit then use:
onsubmit="return (function1(this.formname.value) && function2());" If you just want to call multiple functions do this and make sure that you have the return on the LAST function call (or after if you always want it to fail/succeed)
onsubmit="function2();return function1(this.formname.value);"

Reno CF
05-11-2007, 04:54 AM
Thank you argothian -- I'll try running the 2 script on a test form in the next day -- appreciate your help...