[Javascript] submit a form with Javascript

Jeff Howden jeff at c4webdesign.com
Tue Feb 12 16:53:59 CST 2002


garry,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
> From: garry taylor
>
> 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?
>
> I suppose it's obvious to you guys, but I can't find how to do it!
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

first, start off by reading this article:

Links & JavaScript Living Together in Harmony
http://www.evolt.org/article/javascript/17/20938/index.html

then, do some research into how the onsubmit event handler works.  please,
resist the temptation to use the submit() method.  it's completely
unnecessary in this case.

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/





More information about the Javascript mailing list