Re: onSubmit and submit()

by "Frank Boumphrey" <bckman(at)ix.netcom.com>

 Date:  Thu, 11 May 2000 12:37:17 -0400
 To:  "Albert A. Modderkolk" <mdd(at)advwebsys.com>,
<hwg-techniques(at)mail.hwg.org>
 References:  tin
  todo: View Thread, Original
Albert,

you have to reference tthe form ie if it is the first form on your page

onClick="document.forms[0].submit()"

It's best though not to put it in line, but to call a seperate function, and
put your code there. you can then do all your checking etc inside the
function and not use the onSubmit funstion.

function submitform()
{
 var formserror
   // error checking code here
 if (formserror==true)
   {
   alert("there were errors");
    return;
   }
 else
   {
    document.forms[0].submit();
  }
}

HTH

Frank
----- Original Message -----
From: Albert A. Modderkolk <mdd(at)advwebsys.com>
To: <hwg-techniques(at)mail.hwg.org>
Sent: Thursday, May 11, 2000 4:37 AM
Subject: onSubmit and submit()


> Is it possible that the combination doesn't work?
> I have tried to use onClick="document.form.submit()" and to use the
> onSubmit on the FORM statement to do some checking.  As far as I can
> see onSubmit is then not invoked.
>
> Tia, Albert
>
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA