[Javascript] submit a form with Javascript

Andrew Gibson andyg at ihug.co.nz
Tue Feb 12 05:23:33 CST 2002


> This may seem a bit of a dumb question, but how can I submit a form 
> using Javascript? Right now I am using onSubmit="myform.cgi" in my form 
> tag. This works fine, but now I want to check a few form elements beofre 
> it gets submitted, so presumably, I make myself a Javascript function 
> which gets called by onSubmit(). But when inside onSubmit(), and I have 
> verified my form elements, how do I then call myform.cgi?

Assuming your form is named "myform" how about this:

document.myform.submit()






More information about the Javascript mailing list