Help me. I have been battling with this thing for ages. Have a subscribe to our mailing list thing on our site that I wish to submit to a popup window for processing but can't figure out how. If anyway can help you will be saving my life!
Here's the code as is:
Sign Up page - signup.asp
------------
<HTML>
<HEAD>
<script language="JavaScript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll,resize){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+''
win = window.open(mypage,myname,settings)
}
</script>
</HEAD>
<BODY>
<form target="PopUp" method="post" onSubmit="NewWindow('subscribe.asp','PopUp','300','200','no','no')">
<span class="infobox">Email:</span>
<input name="u_email" type="text" value="<%= lcase(u_email) %>" size="8">
<input type="submit" value="Join" name="u_submit">
</form>
</BODY>
</HTML>
When the page is submitted I want the following asp page to open in the popup window which then processes the form:
PROCESSING PAGE - subscribe.asp
---------------
<html>
<head>
<title>ITR Newsletter Subscription Request</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../itr.css" rel="stylesheet" type="text/css">
<SCRIPT TYPE="text/javascript">
<!--
window.focus();
//-->
</SCRIPT>
</head>
<body>
<p>
<%
' Checks to see if the user inputted a value
' If so, remove leading and trailing blanks and upcase it
u_email= ucase(trim(request.form("u_email"
))
' Grab the length of the email address inputted
email_len=len(u_email)
' if the user has inputted a value start checking it
if trim(u_email) <> "" then
' Loop that will check each character of the inputted value
' for the @ and the dot
for counter = 1 to email_len
'If there is an @ set u_at to the position it was found in
if mid(u_email,counter,1)="@" then
' count the number of @'s
at_counter=at_counter+1
' if there is more than one add it to the message
if at_counter > 1 then
if (message = ""
then
message = "<B>Errors Reported:</B><BR>"
end if
message = message & "There appear to be multiple @'s in the email address.<br>"
end if
' if this is the 1st @ note the location in the string
if u_at = "" then
u_at=counter
end if ' end check for first @
end if ' end check for the @
'If there is an dot (.) set u_dot to the position it was found in
if mid(u_email,counter,1)="." then
if u_dot = "" then
u_dot=counter
end if 'end check for the first dot
end if 'end check for the dot
next
' Check to see if the dot comes after the @
' and that the first dot is not the last character
if (u_dot < u_at) or (len(u_email) <= u_dot+1) or ((u_dot-u_at) < 2) or (u_at < 2)then
if (message = ""
then
message = "<B>Errors Reported:</B><BR>"
end if
message = message & "The email address convention appears to be wrong. <br>"
end if 'end check for dot after the @
' Scan the user input to see that all inputted values are either a letter A-Z,
' a number 0-9 or if the character is a . or and @.
for counter=1 to len(u_email)
if (mid(u_email,counter,1) <> "/"
and ((mid(u_email,counter,1) > chr(45)) and (mid(u_email,counter,1) < chr(58))) or ((mid(u_email,counter,1) > chr(63)) and (mid(u_email,counter,1) < chr(91))) then
else
' Check it isn't the "-" character
if (mid(u_email,counter,1) <> "-"
then
' If it's an invalid charcter add it to the display message
if (message = ""
then
message = "<B>Errors Reported:</B><BR>"
end if
message = message & "The following invalid character was found in the email address: """& mid(u_email,counter,1)& """ <br>"
end if 'end check for "-" character
end if 'end check for invalid characters
next 'end loop for invalid characters
end if 'end check for user input
' Check the email field for input if is blank
' then add to the display message
if (u_email = ""
then
if (message = ""
then
message = "<B>Errors Reported:</B><BR>"
end if
message= message & "Please enter an email address.<br>"
end if
'--------------------------------------------------------------------
' If the email address is not OK than display the error message(s)
if message <> "" or u_email = "" then
response.write "<P class=""StandardText"">"
response.write message
response.write "</P>"
'--------------------------------------------------------------------
' If all seems ok begin processing the email
else
'Lower case email
u_email = lcase(u_email)
' -----------------------------------------
' This is the begining of the email creation and execution
' Create a new mail object on the server
set sm = server.CreateObject("CDONTS.Newmail"
' Declare what address is sending the message
sm.from = u_email
' subject of the email
sm.Subject = ""
' Declare what address the message is being sent to
sm.to = "mdaemon@it-r.net"
' Write the users message to the body of the email
sm.body = "SUBSCRIBE newsletter"
' Specify format of email
sm.BodyFormat=0
sm.MailFormat=0
' Send the message
sm.Send
' Clean up the server object
set sm = nothing
' -----------------------------------------
'Reset all the variables
u_email = ""
message = ""
'You application has been sent!
response.write "<P class=""StandardText"">"
response.write "Thankyou for signing up to the IT Resources newsletter.<BR><BR><B>Your subscription request has been sent!</B>"
response.write "</P>"
end if %>
</p>
<p align="center" class="infobox"><a href="javascript: self.close()">close window</a></p>
</body>
</html>
This asp stuff works fine if i just link to this page but if I try to do it as a popup - nothing.
Thanks in advance
Slinka
Here's the code as is:
Sign Up page - signup.asp
------------
<HTML>
<HEAD>
<script language="JavaScript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll,resize){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+''
win = window.open(mypage,myname,settings)
}
</script>
</HEAD>
<BODY>
<form target="PopUp" method="post" onSubmit="NewWindow('subscribe.asp','PopUp','300','200','no','no')">
<span class="infobox">Email:</span>
<input name="u_email" type="text" value="<%= lcase(u_email) %>" size="8">
<input type="submit" value="Join" name="u_submit">
</form>
</BODY>
</HTML>
When the page is submitted I want the following asp page to open in the popup window which then processes the form:
PROCESSING PAGE - subscribe.asp
---------------
<html>
<head>
<title>ITR Newsletter Subscription Request</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../itr.css" rel="stylesheet" type="text/css">
<SCRIPT TYPE="text/javascript">
<!--
window.focus();
//-->
</SCRIPT>
</head>
<body>
<p>
<%
' Checks to see if the user inputted a value
' If so, remove leading and trailing blanks and upcase it
u_email= ucase(trim(request.form("u_email"
' Grab the length of the email address inputted
email_len=len(u_email)
' if the user has inputted a value start checking it
if trim(u_email) <> "" then
' Loop that will check each character of the inputted value
' for the @ and the dot
for counter = 1 to email_len
'If there is an @ set u_at to the position it was found in
if mid(u_email,counter,1)="@" then
' count the number of @'s
at_counter=at_counter+1
' if there is more than one add it to the message
if at_counter > 1 then
if (message = ""
message = "<B>Errors Reported:</B><BR>"
end if
message = message & "There appear to be multiple @'s in the email address.<br>"
end if
' if this is the 1st @ note the location in the string
if u_at = "" then
u_at=counter
end if ' end check for first @
end if ' end check for the @
'If there is an dot (.) set u_dot to the position it was found in
if mid(u_email,counter,1)="." then
if u_dot = "" then
u_dot=counter
end if 'end check for the first dot
end if 'end check for the dot
next
' Check to see if the dot comes after the @
' and that the first dot is not the last character
if (u_dot < u_at) or (len(u_email) <= u_dot+1) or ((u_dot-u_at) < 2) or (u_at < 2)then
if (message = ""
message = "<B>Errors Reported:</B><BR>"
end if
message = message & "The email address convention appears to be wrong. <br>"
end if 'end check for dot after the @
' Scan the user input to see that all inputted values are either a letter A-Z,
' a number 0-9 or if the character is a . or and @.
for counter=1 to len(u_email)
if (mid(u_email,counter,1) <> "/"
else
' Check it isn't the "-" character
if (mid(u_email,counter,1) <> "-"
' If it's an invalid charcter add it to the display message
if (message = ""
message = "<B>Errors Reported:</B><BR>"
end if
message = message & "The following invalid character was found in the email address: """& mid(u_email,counter,1)& """ <br>"
end if 'end check for "-" character
end if 'end check for invalid characters
next 'end loop for invalid characters
end if 'end check for user input
' Check the email field for input if is blank
' then add to the display message
if (u_email = ""
if (message = ""
message = "<B>Errors Reported:</B><BR>"
end if
message= message & "Please enter an email address.<br>"
end if
'--------------------------------------------------------------------
' If the email address is not OK than display the error message(s)
if message <> "" or u_email = "" then
response.write "<P class=""StandardText"">"
response.write message
response.write "</P>"
'--------------------------------------------------------------------
' If all seems ok begin processing the email
else
'Lower case email
u_email = lcase(u_email)
' -----------------------------------------
' This is the begining of the email creation and execution
' Create a new mail object on the server
set sm = server.CreateObject("CDONTS.Newmail"
' Declare what address is sending the message
sm.from = u_email
' subject of the email
sm.Subject = ""
' Declare what address the message is being sent to
sm.to = "mdaemon@it-r.net"
' Write the users message to the body of the email
sm.body = "SUBSCRIBE newsletter"
' Specify format of email
sm.BodyFormat=0
sm.MailFormat=0
' Send the message
sm.Send
' Clean up the server object
set sm = nothing
' -----------------------------------------
'Reset all the variables
u_email = ""
message = ""
'You application has been sent!
response.write "<P class=""StandardText"">"
response.write "Thankyou for signing up to the IT Resources newsletter.<BR><BR><B>Your subscription request has been sent!</B>"
response.write "</P>"
end if %>
</p>
<p align="center" class="infobox"><a href="javascript: self.close()">close window</a></p>
</body>
</html>
This asp stuff works fine if i just link to this page but if I try to do it as a popup - nothing.
Thanks in advance
Slinka