looknow12
asked on
CDONTS Mail Information Request Form simply refreshes when clicking submit.
Not certain if this is a ASP issue or Submit Form issue. Admittedly a newbie to this.
When clicking on submit, instead of executing my response.write, it simply refreshes the page. I did this a long time ago, and can't remember if I was calling another ASP page, or if everything was coded in the same, like this is. Forgive me if I'm including too much code.
Form Code Starts ----------->
// -->
</script>
</blockquote> <table width="671">
<tr>
<td valign="top"><div align="right">Name</div></ td>
<td width="317" valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input name="fullname" type="text" id="fullname">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Home Phone </div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input type="text" name="homephone">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Work Phone</div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input type="text" name="workphone">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Mobile Phone </div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input name="mobilephone" type="text" id="mobilephone">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Town or City </div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input name="cityfield" type="text" size="50" maxlength="50">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">State or Country </div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input name="statefield" type="text" size="50" maxlength="50">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Email Address </div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input name="emailfield" type="text" id="emailaddress">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Your Broker or Agent </div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input name="brokername" type="text" id="brokername">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Your broker or agent's phone number </div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input name="brokernumber" type="text" id="brokernumber">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right"></div></td>
<td valign="middle" bordercolor="#0033CC">&nbs p;</td>
</tr>
<tr>
<td valign="top"><div align="right"></div></td>
<td valign="middle" bordercolor="#0033CC"><for m action="" method="post" name="form1" id="form1">
<input name="Contact Us" type="submit" onClick="MM_validateForm(' fullname', 'RisEmail' );return document.MM_returnValue" value="Submit">
</form></td>
</tr>
</table>
Form code Ends ------>
ASP Code Starts (Including /header and body tags to indicate where I've placed it) ----------->
</head>
<%
if request.form("EmailAddress ")<>"" then
Response.Write("hello")
Set cdomail=server.CreateObjec t("CDO.Mes sage")
' cdomail.mailformat=0
'<---- for html format
'cdomail.bodyformat=0
'<------- for html format
cdomail.from="inforequest@ mydomain.c om"
cdomail.to = "looknow12@mydomain.com"
'<--- to email id
cdomail.Bcc = "bcc@mydomain.com"
'< ---- bcc email delimit by ;
cdomail.subject="Ardsley Square Request of Info"
'<--- CREATE html body into HTML variable
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<body>"
HTML = HTML & "<p class='style1'> </p>"
HTML = HTML & "<table width='763' border='0' align='left' cellpadding='0' cellspacing='0' bgcolor='#FFCC00'>"
HTML = HTML & "<tr>"
HTML = HTML & "<th width='763' scope='col'><div align='left'><span class='style1'>Information Request has been Filled out </span></div></th>"
HTML = HTML & "</tr>"
HTML = HTML & "</table><br>"
HTML = HTML & "<hr><br>"
HTML = HTML & "<table width='763' border='1' align='default' cellpadding='0' cellspacing='1' bordercolor='#000000' bgcolor='#FFCC99'>"
HTML = HTML & "<td class='style1'><div align='right'><b>Contact</ div></b></ td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("fullname")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Home Phone</div></b></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("homephone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Work Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("WorkPhone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Mobile Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("Mobilephone" )
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>City</b>< /div></td> "
HTML = HTML & "<td>"
HTML = HTML & Request.Form("CityField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>State</b> </div></td >"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("StateField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Email Address</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("emailfield")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Name</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokername")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Number</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokernumber ")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
'<--- END create html body into HTML variable
cdomail.HTMLbody=HTML
'< --- Body content
cdomail.Send
'<--- Sends the email
set cdomail=nothing
Response.Write("<br><align ='center' size='2'><b> Thank you for submitting your information</b><br>A representative will contact you shortly.</font>")
end if
%>
<body>
When clicking on submit, instead of executing my response.write, it simply refreshes the page. I did this a long time ago, and can't remember if I was calling another ASP page, or if everything was coded in the same, like this is. Forgive me if I'm including too much code.
Form Code Starts ----------->
// -->
</script>
</blockquote> <table width="671">
<tr>
<td valign="top"><div align="right">Name</div></
<td width="317" valign="middle" bordercolor="#0033CC"><for
<input name="fullname" type="text" id="fullname">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Home Phone </div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input type="text" name="homephone">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Work Phone</div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input type="text" name="workphone">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Mobile Phone </div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input name="mobilephone" type="text" id="mobilephone">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Town or City </div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input name="cityfield" type="text" size="50" maxlength="50">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">State or Country </div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input name="statefield" type="text" size="50" maxlength="50">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Email Address </div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input name="emailfield" type="text" id="emailaddress">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Your Broker or Agent </div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input name="brokername" type="text" id="brokername">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right">Your broker or agent's phone number </div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input name="brokernumber" type="text" id="brokernumber">
</form></td>
</tr>
<tr>
<td valign="top"><div align="right"></div></td>
<td valign="middle" bordercolor="#0033CC">&nbs
</tr>
<tr>
<td valign="top"><div align="right"></div></td>
<td valign="middle" bordercolor="#0033CC"><for
<input name="Contact Us" type="submit" onClick="MM_validateForm('
</form></td>
</tr>
</table>
Form code Ends ------>
ASP Code Starts (Including /header and body tags to indicate where I've placed it) ----------->
</head>
<%
if request.form("EmailAddress
Response.Write("hello")
Set cdomail=server.CreateObjec
' cdomail.mailformat=0
'<---- for html format
'cdomail.bodyformat=0
'<------- for html format
cdomail.from="inforequest@
cdomail.to = "looknow12@mydomain.com"
'<--- to email id
cdomail.Bcc = "bcc@mydomain.com"
'< ---- bcc email delimit by ;
cdomail.subject="Ardsley Square Request of Info"
'<--- CREATE html body into HTML variable
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<body>"
HTML = HTML & "<p class='style1'> </p>"
HTML = HTML & "<table width='763' border='0' align='left' cellpadding='0' cellspacing='0' bgcolor='#FFCC00'>"
HTML = HTML & "<tr>"
HTML = HTML & "<th width='763' scope='col'><div align='left'><span class='style1'>Information
HTML = HTML & "</tr>"
HTML = HTML & "</table><br>"
HTML = HTML & "<hr><br>"
HTML = HTML & "<table width='763' border='1' align='default' cellpadding='0' cellspacing='1' bordercolor='#000000' bgcolor='#FFCC99'>"
HTML = HTML & "<td class='style1'><div align='right'><b>Contact</
HTML = HTML & "<td>"
HTML = HTML & Request.Form("fullname")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Home Phone</div></b></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("homephone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Work Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("WorkPhone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Mobile Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("Mobilephone"
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>City</b><
HTML = HTML & "<td>"
HTML = HTML & Request.Form("CityField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>State</b>
HTML = HTML & "<td>"
HTML = HTML & Request.Form("StateField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Email Address</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("emailfield")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Name</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokername")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Number</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokernumber
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
'<--- END create html body into HTML variable
cdomail.HTMLbody=HTML
'< --- Body content
cdomail.Send
'<--- Sends the email
set cdomail=nothing
Response.Write("<br><align
end if
%>
<body>
ASKER
Another issue is I have know way of know if CDONTS.DLL is even getting called. Is there a way to troubleshoot this server side?
your form tag shows that its submitting to the same page that you form is on. is this alright? does your asp code live on the same page as the form tag?
<form action="" method="post" name="form1" id="form1">
----------------^
<form action="" method="post" name="form1" id="form1">
----------------^
Not sure if this will solve your issue but, since all your forms have the same name you only need one. The divs are also redundant.
<form action="" method="post" name="form1" id="form1">
<table width="671">
<tr>
<td valign="top" align="right">Name</td>
<td width="317" valign="middle" bordercolor="#0033CC">
<input name="fullname" type="text" id="fullname">
</td>
</tr>
<tr>
<td valign="top" align="right">Home Phone</td>
<td valign="middle" bordercolor="#0033CC">
<input type="text" name="homephone">
</td>
</tr>
<tr>
<td valign="top" align="right">Work Phone</td>
<td valign="middle" bordercolor="#0033CC">
<input type="text" name="workphone">
</td>
</tr>
<tr>
<td valign="top" align="right">Mobile Phone</td>
<td valign="middle" bordercolor="#0033CC">
<input name="mobilephone" type="text" id="mobilephone">
</td>
</tr>
<tr>
<td valign="top" align="right">Town or City</td>
<td valign="middle" bordercolor="#0033CC">
<input name="cityfield" type="text" size="50" maxlength="50">
</td>
</tr>
<tr>
<td valign="top" align="right">State or Country</td>
<td valign="middle" bordercolor="#0033CC">
<input name="statefield" type="text" size="50" maxlength="50">
</td>
</tr>
<tr>
<td valign="top" align="right">Email Address</td>
<td valign="middle" bordercolor="#0033CC">
<input name="emailfield" type="text" id="emailaddress">
</td>
</tr>
<tr>
<td valign="top" align="right">Your Broker or Agent</td>
<td valign="middle" bordercolor="#0033CC">
<input name="brokername" type="text" id="brokername">
</td>
</tr>
<tr>
<td valign="top" align="right">Your broker or agent's phone number</td>
<td valign="middle" bordercolor="#0033CC">
<input name="brokernumber" type="text" id="brokernumber">
</td>
</tr>
<tr>
<td valign="top" align="right"></td>
<td valign="middle" bordercolor="#0033CC">&nbs p;</td>
</tr>
<tr>
<td valign="top" align="right"></td>
<td valign="middle" bordercolor="#0033CC">
<input name="Contact Us" type="submit" onClick="MM_validateForm(' fullname', 'RisEmail' );return document.MM_returnValue" value="Submit">
</td>
</tr>
</table>
</form>
<form action="" method="post" name="form1" id="form1">
<table width="671">
<tr>
<td valign="top" align="right">Name</td>
<td width="317" valign="middle" bordercolor="#0033CC">
<input name="fullname" type="text" id="fullname">
</td>
</tr>
<tr>
<td valign="top" align="right">Home Phone</td>
<td valign="middle" bordercolor="#0033CC">
<input type="text" name="homephone">
</td>
</tr>
<tr>
<td valign="top" align="right">Work Phone</td>
<td valign="middle" bordercolor="#0033CC">
<input type="text" name="workphone">
</td>
</tr>
<tr>
<td valign="top" align="right">Mobile Phone</td>
<td valign="middle" bordercolor="#0033CC">
<input name="mobilephone" type="text" id="mobilephone">
</td>
</tr>
<tr>
<td valign="top" align="right">Town or City</td>
<td valign="middle" bordercolor="#0033CC">
<input name="cityfield" type="text" size="50" maxlength="50">
</td>
</tr>
<tr>
<td valign="top" align="right">State or Country</td>
<td valign="middle" bordercolor="#0033CC">
<input name="statefield" type="text" size="50" maxlength="50">
</td>
</tr>
<tr>
<td valign="top" align="right">Email Address</td>
<td valign="middle" bordercolor="#0033CC">
<input name="emailfield" type="text" id="emailaddress">
</td>
</tr>
<tr>
<td valign="top" align="right">Your Broker or Agent</td>
<td valign="middle" bordercolor="#0033CC">
<input name="brokername" type="text" id="brokername">
</td>
</tr>
<tr>
<td valign="top" align="right">Your broker or agent's phone number</td>
<td valign="middle" bordercolor="#0033CC">
<input name="brokernumber" type="text" id="brokernumber">
</td>
</tr>
<tr>
<td valign="top" align="right"></td>
<td valign="middle" bordercolor="#0033CC">&nbs
</tr>
<tr>
<td valign="top" align="right"></td>
<td valign="middle" bordercolor="#0033CC">
<input name="Contact Us" type="submit" onClick="MM_validateForm('
</td>
</tr>
</table>
</form>
ASKER
ASP Code and Form are in the same page.
>>Not sure if this will solve your issue but, since all your forms have the same name you only need one.
good call, i didnt catch that.
@looknow12 - you should only have one form tag surround all of these fields.
good call, i didnt catch that.
@looknow12 - you should only have one form tag surround all of these fields.
ASKER
I changed it, but still when I click submit, the form (page) simply refreshes. Is there any way to start adding some debug code? I'm not certain if it is my form code or my asp code.
ASKER
If I changed the method to Get, the URL does change to include all of the details. My action is empty, does this need to somehow call the script even if the ASP script is in the same page?
ASKER
BTW, my last line End If used to be Else END in an older form I used to run. I couldn't successfully get Else END to work, only END If. Could that be something?
there should be no else end in vbscript.
one problem i just noticed is that on your email form field, the name and id do not match. they need to match:
<input name="emailfield" type="text" id="emailaddress">
go through all your form fields and assign name and id attributes to them all, and make sure they are the same.
one problem i just noticed is that on your email form field, the name and id do not match. they need to match:
<input name="emailfield" type="text" id="emailaddress">
go through all your form fields and assign name and id attributes to them all, and make sure they are the same.
ASKER
I've changed it. Still just refreshes. Here's my latest code:
HTML Form:
<tr>
<td valign="top"><div align="right">Name</div></ td>
<td width="317" valign="middle" bordercolor="#0033CC">
<form action="" method="Post" name="form" id="form">
<input name="fullname" type="text" id="fullname">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Home Phone </div></td>
<td valign="middle" bordercolor="#0033CC">
<input type="text" name="homephone" id="homephone">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Work Phone</div></td>
<td valign="middle" bordercolor="#0033CC">
<input type="text" name="workphone" id="workphone">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Mobile Phone </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="mobilephone" type="text" id="mobilephone">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Town or City </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="cityfield" id="cityfield" type="text" size="50" maxlength="50">
</td>
</tr>
<tr>
<td valign="top"><div align="right">State or Country </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="statefield" id="statefield" type="text" size="50" maxlength="50">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Email Address </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="emailfield" type="text" id="emailfield">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Your Broker or Agent </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="brokername" type="text" id="brokername">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Your broker or agent's phone number </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="brokernumber" type="text" id="brokernumber">
</td>
</tr>
<tr>
<td valign="top"><div align="right"></div></td>
<td valign="middle" bordercolor="#0033CC">&nbs p;</td>
</tr>
<tr>
<td valign="top"><div align="right"></div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="Contact Us" type="submit" id="Contact Us" onClick="MM_validateForm(' fullname', 'RisEmail' );return document.MM_returnValue" value="Submit">
</form></td>
</tr>
ASP Code:
<%
if request.form("EmailAddress ")<>"" then
Response.Write("hello")
Set cdomail=server.CreateObjec t("CDO.Mes sage")
' cdomail.mailformat=0
'<---- for html format
'cdomail.bodyformat=0
'<------- for html format
cdomail.from="looknow12@ar dsleysquar e.com"
cdomail.to = "looknow12@ardsleysquare.c om"
'<--- to email id
cdomail.Bcc = "looknow12@ardsleysquare.c om"
'< ---- bcc email delimit by ;
cdomail.subject="Ardsley Square Request of Info"
'<--- CREATE html body into HTML variable
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<body>"
HTML = HTML & "<p class='style1'> </p>"
HTML = HTML & "<table width='763' border='0' align='left' cellpadding='0' cellspacing='0' bgcolor='#FFCC00'>"
HTML = HTML & "<tr>"
HTML = HTML & "<th width='763' scope='col'><div align='left'><span class='style1'>Information Request has been Filled out </span></div></th>"
HTML = HTML & "</tr>"
HTML = HTML & "</table><br>"
HTML = HTML & "<hr><br>"
HTML = HTML & "<table width='763' border='1' align='default' cellpadding='0' cellspacing='1' bordercolor='#000000' bgcolor='#FFCC99'>"
HTML = HTML & "<td class='style1'><div align='right'><b>Contact</ div></b></ td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("fullname")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Home Phone</div></b></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("homephone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Work Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("WorkPhone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Mobile Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("Mobilephone" )
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>City</b>< /div></td> "
HTML = HTML & "<td>"
HTML = HTML & Request.Form("CityField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>State</b> </div></td >"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("StateField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Email Address</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("emailfield")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Name</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokername")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Number</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokernumber ")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
'<--- END create html body into HTML variable
cdomail.HTMLbody=HTML
'< --- Body content
cdomail.Send
'<--- Sends the email
set cdomail=nothing
Response.Write("<br><align ='center' size='2'><b> Thank you for submitting your information</b><br>A representative will contact you shortly.</font>")
end if
%>
HTML Form:
<tr>
<td valign="top"><div align="right">Name</div></
<td width="317" valign="middle" bordercolor="#0033CC">
<form action="" method="Post" name="form" id="form">
<input name="fullname" type="text" id="fullname">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Home Phone </div></td>
<td valign="middle" bordercolor="#0033CC">
<input type="text" name="homephone" id="homephone">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Work Phone</div></td>
<td valign="middle" bordercolor="#0033CC">
<input type="text" name="workphone" id="workphone">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Mobile Phone </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="mobilephone" type="text" id="mobilephone">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Town or City </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="cityfield" id="cityfield" type="text" size="50" maxlength="50">
</td>
</tr>
<tr>
<td valign="top"><div align="right">State or Country </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="statefield" id="statefield" type="text" size="50" maxlength="50">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Email Address </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="emailfield" type="text" id="emailfield">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Your Broker or Agent </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="brokername" type="text" id="brokername">
</td>
</tr>
<tr>
<td valign="top"><div align="right">Your broker or agent's phone number </div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="brokernumber" type="text" id="brokernumber">
</td>
</tr>
<tr>
<td valign="top"><div align="right"></div></td>
<td valign="middle" bordercolor="#0033CC">&nbs
</tr>
<tr>
<td valign="top"><div align="right"></div></td>
<td valign="middle" bordercolor="#0033CC">
<input name="Contact Us" type="submit" id="Contact Us" onClick="MM_validateForm('
</form></td>
</tr>
ASP Code:
<%
if request.form("EmailAddress
Response.Write("hello")
Set cdomail=server.CreateObjec
' cdomail.mailformat=0
'<---- for html format
'cdomail.bodyformat=0
'<------- for html format
cdomail.from="looknow12@ar
cdomail.to = "looknow12@ardsleysquare.c
'<--- to email id
cdomail.Bcc = "looknow12@ardsleysquare.c
'< ---- bcc email delimit by ;
cdomail.subject="Ardsley Square Request of Info"
'<--- CREATE html body into HTML variable
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<body>"
HTML = HTML & "<p class='style1'> </p>"
HTML = HTML & "<table width='763' border='0' align='left' cellpadding='0' cellspacing='0' bgcolor='#FFCC00'>"
HTML = HTML & "<tr>"
HTML = HTML & "<th width='763' scope='col'><div align='left'><span class='style1'>Information
HTML = HTML & "</tr>"
HTML = HTML & "</table><br>"
HTML = HTML & "<hr><br>"
HTML = HTML & "<table width='763' border='1' align='default' cellpadding='0' cellspacing='1' bordercolor='#000000' bgcolor='#FFCC99'>"
HTML = HTML & "<td class='style1'><div align='right'><b>Contact</
HTML = HTML & "<td>"
HTML = HTML & Request.Form("fullname")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Home Phone</div></b></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("homephone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Work Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("WorkPhone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Mobile Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("Mobilephone"
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>City</b><
HTML = HTML & "<td>"
HTML = HTML & Request.Form("CityField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>State</b>
HTML = HTML & "<td>"
HTML = HTML & Request.Form("StateField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Email Address</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("emailfield")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Name</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokername")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Number</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokernumber
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
'<--- END create html body into HTML variable
cdomail.HTMLbody=HTML
'< --- Body content
cdomail.Send
'<--- Sends the email
set cdomail=nothing
Response.Write("<br><align
end if
%>
is your asp code above your html code or below? it should be above the html code.
also, i would like to try this code at the top of your page to get the result.
<%
if lcase(request.servervariab les("REQUE ST_METHOD" )) = "post" then
Dim Item
For Each Item In Request.Form
Response.Write(Item & ": " & Request.Form(Item) & "<BR>")
Next
response.end()
end if
%>
also, i would like to try this code at the top of your page to get the result.
<%
if lcase(request.servervariab
Dim Item
For Each Item In Request.Form
Response.Write(Item & ": " & Request.Form(Item) & "<BR>")
Next
response.end()
end if
%>
ASKER
My ASP code is above the html code right below /header
I put your code in there and after clicking submit it shows all fields.
So something is wrong with my asp code, I guess. CDONTS?
I put your code in there and after clicking submit it shows all fields.
So something is wrong with my asp code, I guess. CDONTS?
ASKER
I tried having the form call sendmail.asp and then at the end using a Response.Redirect("mailsen t.htm")
(just learned how).
After clicking submit, the URL does change the sendmail.asp but does not get redirected to mailsent
Mail.asp webpage as contact_us (the page with the form in it)
I just wish I had a way to test cdonts.dll
(just learned how).
After clicking submit, the URL does change the sendmail.asp but does not get redirected to mailsent
Mail.asp webpage as contact_us (the page with the form in it)
I just wish I had a way to test cdonts.dll
ASKER
Getting somewhere...
My if request.form("EmailAddress ")<>"" then wasn't enough to execute the code. So I used your if lcase(request.servervariab les("REQUE ST_METHOD" )) = "post" then
Here's my ASP Code now: Below look for my ASP error, finally:
<%
Response.Write("hello")
if lcase(request.servervariab les("REQUE ST_METHOD" )) = "post" then
Response.Write("hello")
Set cdomail=server.CreateObjec t("CDO.Mes sage")
' cdomail.mailformat=0
'<---- for html format
'cdomail.bodyformat=0
'<------- for html format
cdomail.from="greggm@merce de.net"
cdomail.to = "greggm@mercede.net"
'<--- to email id
cdomail.Bcc = "cindy@mercede.net"
'< ---- bcc email delimit by ;
cdomail.subject="Ardsley Square Request of Info"
'<--- CREATE html body into HTML variable
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<body>"
HTML = HTML & "<p class='style1'> </p>"
HTML = HTML & "<table width='763' border='0' align='left' cellpadding='0' cellspacing='0' bgcolor='#FFCC00'>"
HTML = HTML & "<tr>"
HTML = HTML & "<th width='763' scope='col'><div align='left'><span class='style1'>Information Request has been Filled out </span></div></th>"
HTML = HTML & "</tr>"
HTML = HTML & "</table><br>"
HTML = HTML & "<hr><br>"
HTML = HTML & "<table width='763' border='1' align='default' cellpadding='0' cellspacing='1' bordercolor='#000000' bgcolor='#FFCC99'>"
HTML = HTML & "<td class='style1'><div align='right'><b>Contact</ div></b></ td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("fullname")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Home Phone</div></b></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("homephone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Work Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("WorkPhone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Mobile Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("Mobilephone" )
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>City</b>< /div></td> "
HTML = HTML & "<td>"
HTML = HTML & Request.Form("CityField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>State</b> </div></td >"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("StateField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Email Address</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("emailfield")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Name</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokername")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Number</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokernumber ")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
'<--- END create html body into HTML variable
cdomail.HTMLbody=HTML
'< --- Body content
cdomail.Send
'<--- Sends the email
set cdomail=nothing
Response.Redirect("mailsen t.htm")
end if
%>
And here's my error message:
hellohello
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/contact_us.asp, line 225
800401f3
My if request.form("EmailAddress
Here's my ASP Code now: Below look for my ASP error, finally:
<%
Response.Write("hello")
if lcase(request.servervariab
Response.Write("hello")
Set cdomail=server.CreateObjec
' cdomail.mailformat=0
'<---- for html format
'cdomail.bodyformat=0
'<------- for html format
cdomail.from="greggm@merce
cdomail.to = "greggm@mercede.net"
'<--- to email id
cdomail.Bcc = "cindy@mercede.net"
'< ---- bcc email delimit by ;
cdomail.subject="Ardsley Square Request of Info"
'<--- CREATE html body into HTML variable
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<body>"
HTML = HTML & "<p class='style1'> </p>"
HTML = HTML & "<table width='763' border='0' align='left' cellpadding='0' cellspacing='0' bgcolor='#FFCC00'>"
HTML = HTML & "<tr>"
HTML = HTML & "<th width='763' scope='col'><div align='left'><span class='style1'>Information
HTML = HTML & "</tr>"
HTML = HTML & "</table><br>"
HTML = HTML & "<hr><br>"
HTML = HTML & "<table width='763' border='1' align='default' cellpadding='0' cellspacing='1' bordercolor='#000000' bgcolor='#FFCC99'>"
HTML = HTML & "<td class='style1'><div align='right'><b>Contact</
HTML = HTML & "<td>"
HTML = HTML & Request.Form("fullname")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Home Phone</div></b></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("homephone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Work Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("WorkPhone")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Mobile Phone</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("Mobilephone"
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>City</b><
HTML = HTML & "<td>"
HTML = HTML & Request.Form("CityField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>State</b>
HTML = HTML & "<td>"
HTML = HTML & Request.Form("StateField")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Email Address</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("emailfield")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Name</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokername")
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "<tr>"
HTML = HTML & "<td class='style1'><div align='right'><b>Broker Number</b></div></td>"
HTML = HTML & "<td>"
HTML = HTML & Request.Form("brokernumber
HTML = HTML & "</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
'<--- END create html body into HTML variable
cdomail.HTMLbody=HTML
'< --- Body content
cdomail.Send
'<--- Sends the email
set cdomail=nothing
Response.Redirect("mailsen
end if
%>
And here's my error message:
hellohello
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/contact_us.asp, line 225
800401f3
ASKER
Logged in Event Viewer.
Source Active Server Pages, Category: None, Event 5
Error: The Template Persistent Cache initialization failed for Application Pool 'DefaultAppPool' because of the following error: Could not create a Disk Cache Sub-directory for the Application Pool. The data may have additional error codes..
Source Active Server Pages, Category: None, Event 5
Error: The Template Persistent Cache initialization failed for Application Pool 'DefaultAppPool' because of the following error: Could not create a Disk Cache Sub-directory for the Application Pool. The data may have additional error codes..
ASKER
I fixed it. This took a lot of research because there were more than one factor causing problems.
CDONTS.DLL was still on the machine. CDOSYS was not properly registered and would not register or unregister. I had to search the registry for the INPROCServer32 entry which lead me to unregister CDOEX.DLL and then I could register CDOSYS.DLL properly.
I also needed to add appropriate rights to IISHELP/Common, ASP Temporary Compressed, all shown here http://support.microsoft.com/kb/816789 in this article.
Next, I had to manually set configuration information for SMTP server, port, etc. See code...
Set cdoconfig = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
cdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
cdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
cdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
cdoconfig.Fields.Update
'Update the CDOSYS Configuration
Set cdomail.Configuration = cdoconfig
CDONTS.DLL was still on the machine. CDOSYS was not properly registered and would not register or unregister. I had to search the registry for the INPROCServer32 entry which lead me to unregister CDOEX.DLL and then I could register CDOSYS.DLL properly.
I also needed to add appropriate rights to IISHELP/Common, ASP Temporary Compressed, all shown here http://support.microsoft.com/kb/816789 in this article.
Next, I had to manually set configuration information for SMTP server, port, etc. See code...
Set cdoconfig = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
cdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
cdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
cdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoconfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
cdoconfig.Fields.Update
'Update the CDOSYS Configuration
Set cdomail.Configuration = cdoconfig
so is everything working now? that was some good work figuring out those problems!
ASKER
Yes, working great, thank you.
You are using tha name "emailfield" for your input tag:
<input name="emailfield" type="text" id="emailfield">
But the field name you are checking for is "EmailAddress":
if request.form("EmailAddress ")<>"" then
Should be the same.
<input name="emailfield" type="text" id="emailfield">
But the field name you are checking for is "EmailAddress":
if request.form("EmailAddress
Should be the same.
asker posted that everything is working. why ping?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER