[Javascript] submit a form with Javascript
Esther_Strom at hmco.com
Esther_Strom at hmco.com
Tue Feb 12 08:59:48 CST 2002
Garry,
Don't call your cgi from within your validation script. Call the validation
script onSubmit, using the "return" attribute.
<FORM name="evorder" METHOD="post" ACTION="test.cgi" onSubmit="return
validateForm(this);">
If validateForm returns false (means it doesn't pass whatever validation
tests you've set up), the form doesn't get submitted.
Esther
garry taylor
<gtaylor at lowebro To: javascript at LaTech.edu
adway.com> cc:
Sent by: Subject: Re: [Javascript] submit a form with Javascript
javascript-admin
@LaTech.edu
01/13/70 03:20
PM
Please respond
to javascript
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
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list