[Javascript] submit a form with Javascript
garry taylor
gtaylor at lowebroadway.com
Tue Feb 12 08:15:24 CST 2002
On Tuesday, February 12, 2002, at 11:23 AM, Andrew Gibson wrote:
>> 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()
>
>
I don't think that is exactly what I want, as I think that this would
require the CGI script to be stated within the form, meaning that it
would be run if I hit Enter on any of the entry fields on the form, the
CGI would be run. What I need is to seperate the form and the CGI
script, so that I can choose what to do in Javascript before I choose
whether to run the CGI or not. I think what is required is to call a
Javascript function in the onSubmit tag on the form, which then calls
say 'myfunction', and within myfunction, I can call the CGI. Is this
feasible?
Thanks
Garry
More information about the Javascript
mailing list