Click to See Complete Forum and Search --> : Multiple onSubmit option in Forms


mayassin
09-01-2003, 06:58 PM
I want to include multiple Javascript validation code in my form. for example, the next code uses one validation script like this:

<form name="form" method="post" action="/cgi-bin/registerform.pl" onSubmit="return checkFields();">

Now, how can I add another onSubmit Javascript validation code to the line above without removing the first onSubmit argument, so the Form could check multiple onSubmit scripts inside the form?

Thanks in advance for help.

brendandonhue
09-01-2003, 07:17 PM
Create one onSubmit function that calls all of the individual functions that need to be run.

mayassin
09-01-2003, 09:02 PM
Thanks, but I've tried it and did not work. Could you show me how to do it exactly?

Thnx.

brendandonhue
09-02-2003, 05:21 AM
Something like this

<script type="text/javascript">
function OnSubmit1()
{First onSubmit goes here}
function OnSubmit2
{Second onSubmit goes here}
function OnSubmit3()
{Third onSubmit goes here}
function checkFields()
{
OnSubmit1();
OnSubmit2();
OnSubmit3();
}
</script>