JavaScript Meets CGI Form

by Norm Gregory <norm(at)normgregory.com>

 Date:  Thu, 14 Dec 2000 09:57:07 -0800
 To:  hwg-techniques(at)mail.hwg.org
 In-Reply-To: 
  todo: View Thread, Original
There is great little trick at http://www.developer.irt.org/script/770.htm 
on how you can take a user email address from a form and store it so that 
when the user re-visits the site he/she will not go to the same page but 
will be re-directed to another page.

The JavaScript plants the cookie thusly . .

function set() {
     Set_Cookie("email",document.logonForm.email.value,expires);
}

You have to use the form's name . . . the script example suggests this  . . .

<FORM NAME="logonForm" onSubmit="return set();">
<P>Email: <INPUT TYPE="INPUT" NAME="email">
<P><INPUT TYPE="RESET"> <INPUT TYPE="SUBMIT">
</FORM>

Now to get to my question, finally, I want to use this JavaScript with a 
cgi mail form which uses the usual . . .

<form method=POST action="/cgi/form.cgi">

Where do I put the '<FORM NAME="logonForm"'?

I have tried <form NAME="logonForm" method=POST action="/cgi/form.cgi"> and 
the JavaScript doesn't pick it up.

I have tried <FORM NAME="logonForm"><form method=POST 
action="/cgi/form.cgi"> and the cgi script doesn't work.

Any ideas??

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