abacus566
01-18-2003, 12:30 AM
I currently have the following code on page 1:
<html>
<head>
<title>Email Newsletter Subscription Page 1</title>
<SCRIPT LANGUAGE="JavaScript">
function NewPage(frmobj)
{
if(frmobj.email_addr.value.length==0)
{
alert("Please enter your email address.")
frmobj.email_addr.focus()
}
else
{
var passemail=frmobj.email_addr.value
linkid="page2.htm?"+passemail
location.href=linkid
}
}
</SCRIPT>
</head>
<body>
<form name="newsletter" onSubmit="return NewPage()">
EMAIL:<input name="email_addr" type="text" size="30">
<input name="submit" type="button" id="submit" onClick="NewPage(this.form)" value="SUBMIT">
</form>
</body>
</html>
Which when submitting the form goes to page 2:
<html>
<head>
<title>Email Newsletter Subscription Page 2</title>
</head>
<body>
<form name="newsletter" method="post" action="/cgi-bin/newsletter.cgi">
<p> FIRST NAME:
<INPUT NAME="firstname" TYPE="text" id="firstname" SIZE="30">
<p> LAST NAME:
<INPUT NAME="lastname" TYPE="text" id="lastname" SIZE="30">
<p> EMAIL:
<INPUT NAME="email" TYPE="text" id="email" SIZE="30">
<p>
<input name="Submit" type="button" id="Submit" value="Submit">
<SCRIPT LANGUAGE="JavaScript">
var passdata=unescape(location.search.substring(1,location.search.length))
document.newsletter.email.value=passdata
</SCRIPT>
</form>
</body>
</html>
The problem is, you can't press enter to submit. It'll just create the URL query string but leave the user on the same page. I want to make sure that if the user presses enter they will be taken to page 2 and the email will still auto-populate.
I tried doing this by simply have the form tag include an action=page2.htm but the email was auto populated with the entire querry string, not just the email value.
Let me know if I can be more clear.
Thanks for any help you can give!
<html>
<head>
<title>Email Newsletter Subscription Page 1</title>
<SCRIPT LANGUAGE="JavaScript">
function NewPage(frmobj)
{
if(frmobj.email_addr.value.length==0)
{
alert("Please enter your email address.")
frmobj.email_addr.focus()
}
else
{
var passemail=frmobj.email_addr.value
linkid="page2.htm?"+passemail
location.href=linkid
}
}
</SCRIPT>
</head>
<body>
<form name="newsletter" onSubmit="return NewPage()">
EMAIL:<input name="email_addr" type="text" size="30">
<input name="submit" type="button" id="submit" onClick="NewPage(this.form)" value="SUBMIT">
</form>
</body>
</html>
Which when submitting the form goes to page 2:
<html>
<head>
<title>Email Newsletter Subscription Page 2</title>
</head>
<body>
<form name="newsletter" method="post" action="/cgi-bin/newsletter.cgi">
<p> FIRST NAME:
<INPUT NAME="firstname" TYPE="text" id="firstname" SIZE="30">
<p> LAST NAME:
<INPUT NAME="lastname" TYPE="text" id="lastname" SIZE="30">
<p> EMAIL:
<INPUT NAME="email" TYPE="text" id="email" SIZE="30">
<p>
<input name="Submit" type="button" id="Submit" value="Submit">
<SCRIPT LANGUAGE="JavaScript">
var passdata=unescape(location.search.substring(1,location.search.length))
document.newsletter.email.value=passdata
</SCRIPT>
</form>
</body>
</html>
The problem is, you can't press enter to submit. It'll just create the URL query string but leave the user on the same page. I want to make sure that if the user presses enter they will be taken to page 2 and the email will still auto-populate.
I tried doing this by simply have the form tag include an action=page2.htm but the email was auto populated with the entire querry string, not just the email value.
Let me know if I can be more clear.
Thanks for any help you can give!