|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Hello everyone :D
I need to design a form where the user enters their name, email address and their managers email address. Then, the user proceeds to answer "X" multiple choice questions. I want the form to email the users answers, to both the user and the manager. Below are some screen shot to better explain: ![]() ![]() As of now the form does absolutely nothing... Any insight would be greatly appreciated! and the code: Code:
<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = true
Response.Expires = -1000
%>
<html>
<head>
<title>ESP - Certification - Multiple-Choice Questions</title>
<style type="text/css">
.button {border-style: inset;
border-color: #FAD2A2;
background-color: #FAD2A2;
width: 90px;
text-align: center;
font-family : Verdana;
font-weight: bold;
color : Black;
font-size: 10pt;
padding: 1px}
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" vlink="#800080" topmargin="0" leftmargin="0" onload="ChangeOn()" marginheight="0" marginwidth="0" link="#0000FF" alink="#FF0000">
<div id="main">
<table width="780" border="0" cellspacing="0" cellpadding="5" height="1" align="left">
<tr bgcolor="#FF909B">
<td width="725" height="6" valign="top" bgcolor="#FF9933">
<font face="Verdana, Arial, Helvetica, sans-serif" size="4"><b><i>CERTIFICATION</i></b></font>
</td>
</tr>
<tr bgcolor="#FFBFC6" valign="middle">
<td height="13" bgcolor="#FAD2A2">
<font face="Verdana, Arial, Helvetica, sans-serif" size="4"><b><i>MULTIPLE CHOICE
QUESTIONS</i></b></font>
</td>
</tr>
<tr>
<td valign="top" height="1">
<!-- ------------ INPUT FIELDS START -------------------------------------------------------------------------------------------------- -->
<!-- BELOW ARE THE 3 REQUIRED FIELDS THE USER MUST FILL IN IN ORDER TO SEND THE FORM -->
<%If UCase(Request.Form("Validated") = "VALIDATED") Then%>
<form method="POST" action="<%= Request.ServerVariables("Script_Name")%>" name="frmMain">
<input type="hidden" name="Validated" id="Validated" value="" />
<input TYPE="hidden" NAME="frmMain" VALUE="0">
<font face="Verdana, Arial, Helvetica, sans-serif" size="3">Please enter your name and the email address of yourself and your manager.</font>
<br>
<br>
<!-- 1ST FIELD IS THE USERS FULL NAME -->
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Name</font>
<font size="1">
<br>
<input type="text" name="name" size="30" style="font-family: Verdana; font-size: 10px">
<br>
</font>
</font><br><br>
<!-- 2ND FIELD IS THE USERS EMAIL ADDRESS -->
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Your Email</font>
<font size="1">
<br>
<input type="text" name="email" size="30" style="font-family: Verdana; font-size: 10px">
<br>
</font>
</font><br><br>
<!-- 3RD FIELD IS THE USERS MANAGERS EMAIL ADDRESS -->
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Managers Email</font>
<font size="1">
<br>
<input type="text" name="manager" size="30" style="font-family: Verdana; font-size: 10px">
<br>
</font>
</font><br><br>
<!-- ONCE THE USER HITS THE SUBMIT BUTTON AT THE BOTTOM OF THE PAGE, THE FORM SHOULD BE SENT
TO THE EMAIL ADDRESSES THE USER INPUT IN THE ABOVE 2 FIELDS-->
<!-- ------------ INPUT FIELDS END -------------------------------------------------------------------------------------------------- -->
<!-- ------------ BODY OF FORM START -------------------------------------------------------------------------------------------------- -->
</font></span><font size="2"><span style="font-family: Verdana"><b>1. A Sales
Competitor Analysis allows you to:</b><br>
</span></font><span lang="en-us"><font size="2">
<span style="font-family: Verdana"><input type="radio" value="V1" name="R1">a)
Forecast future business<br>
</span></font><span style="font-size: 12.0pt; font-family: Times New Roman">
<font size="2"><span style="font-family: Verdana">
<input type="radio" name="R1" value="V2">b) Talk negatively about your
competitors<br>
<input type="radio" name="R1" value="V3">c) Identify where needs are likely to
be found<br>
<input type="radio" name="R1" value="V4">d) Position your products<br>
</span></font></span></span></p>
<p class="MsoBodyText"><font size="2" face="Verdana"><b>2. Which of the
following is least important in determining how to position your
products/service?</b><br>
</font><font face="Verdana"><input type="radio" name="R2" value="V1"><span lang="en-us"><font size="2">a)
</font></span><font size="2">Identify those areas where you are strong and the
competitor is weak.<br>
</font><input type="radio" name="R2" value="V2"><span lang="en-us"><font size="2">b)
</font></span><font size="2">Identify the customer’s needs and how they are
currently being met.<br>
</font><input type="radio" name="R2" value="V3"><span lang="en-us"><font size="2">c)
</font></span><font size="2">Identify those areas in which you can
differentiate yourself from the competition.<br>
</font></font><span style="font-size: 12.0pt; font-family: Verdana">
<input type="radio" name="R2" value="V4"></span><span style="font-family: Verdana"><span lang="en-us"><font size="2">d)
</font></span><font size="2">Identify the decision-makers within the
customer’s institute.<br>
</font></span></p>
<!-- ------------ BODY OF FORM END ------------------------------------------------------------------------------------------------------ -->
<!-- ------------ SUBMIT BUTTON START -------------------------------------------------------------------------------------------------- -->
<div align="center">
<a href="javascript:DoSubmit()" class="button" style="text-decoration: none">
<font size="1">SUBMIT</font>
</a>
</div>
<!-- ------------ SUBMIT BUTTON END ----------------------------------------------------------------------------------------------------- -->
<%else SendEmailMessage()%>
</td>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
<%End If%>
<!-- ------------ SEND MAIL CODE START ----------------------------------------------------------------------------------------------------- -->
<%
Sub SendEmailMessage()
Dim objMail
Dim strBody
Set objMail= CreateObject("CDONTS.Newmail")
strBody = "<HTML>"
strBody = strBody &"<HEAD>"
strBody = strBody &"<STYLE>TD{FONT-SIZE:x-small;FONT-FAMILY:Arial}.B {font-weight:700;}.BL {font-weight:700;FONT-SIZE:small;}</STYLE>"
strBody = strBody & "</HEAD><BODY>"
strBody = strBody & "<TABLE WIDTH='100%' CELLPADDING='0'>"
strBody = strBody & "<tr><td> </td></tr>"
strBody = strBody & "<tr><td>"
strBody = StrBody & "<strong><h4>ESP Certification Results</h4></strong>" & chr(10)
strBody = strBody & "</td></tr>"
strBody = strBody & "<tr><td>"
strBody = StrBody & "<strong>Name: </strong>" & Request.Form("name") & chr(10)
strBody = strBody & "</td></tr>"
strBody = strBody & "<tr><td>"
strBody = StrBody & "<strong>Email: </strong>" & Request.Form("email") & chr(10)
strBody = strBody & "</td></tr>"
strBody = strBody & " "
strBody = strBody & "</TABLE>"
strBody = strBody & "</BODY>"
objMail.BodyFormat = 0'HTML
objMail.Body = strBody
objMail.MailFormat = 0'Mime format
objMail.Importance = 2'High
objMail.From = "ESP User"
objMail.To = Request.Form("manager") & ", " & Request.Form("name") & "<" & Request.Form("email") & ">"
objMail.Subject = "ESP User Certification Results"
objMail.Send
Set objMail = Nothing
End Sub
%>
<!-- ------------ SEND MAIL CODE END ----------------------------------------------------------------------------------------------------- -->
<!-- ------------ ERROR POP-UP START ----------------------------------------------------------------------------------------------------- -->
<script Language="Javascript">
function DoSubmit()
{
if(frmMain.name.value=="")
{
window.alert("Your Name is required before submission");
}
else
{
frmMain.Validated.value = 'Validated';
frmMain.submit()
}
}
</script>
<!-- ------------ ERROR POP-UP END ------------------------------------------------------------------------------------------------------- -->
|
|
#2
|
|||
|
|||
|
I think I see what is going on. Your checking to see if the form is validated then displaying it. But if I'm reading it correctly you don't validate the form until it is submitted. So it should not be shown. Is it being shown?
Again if I'm understanding everything then the send email procedure will never be called unless validated is not true. Anyway I could be more help if you explained exactly what is not happing. By the way this post really should be in the ASP section .Last edited by defjamninja : May 2nd, 2003 at 02:50 PM. |
|
#3
|
|||
|
|||
|
Basically, when you bring up the page, fill out ALL appropriate
fields, go through the questions and hit submit, the page reloads and thats about it!?!? I wish I could post the link to the page but it's part of a corporate intranet. my fault for posting here, i'm a newbie to devshed ![]() |
|
#4
|
|||
|
|||
|
What happens if you change the value of Validated? I think that should cause the page to email the form because
Code:
<%If UCase(Request.Form("Validated") = "VALIDATED") Then%>
Code:
<script Language="Javascript">
function DoSubmit()
{
if(frmMain.name.value=="")
{
window.alert("Your Name is required before submission");
}
else
{
frmMain.Validated.value = 'Testing';
frmMain.submit()
}
}
</script>
|
|
#5
|
|||
|
|||
|
hi there ninja!
I tried changing the value like you suggested, but also had no luck. Why is this so difficult?! I have no more options left to try... |
|
#6
|
|||
|
|||
|
AH HA!
I figured out the problem.
Code:
<%If UCase(Request.Form("Validated") = "VALIDATED") Then%>
What you are doing here is setting the form value of validated equal to "VALIDATED" then taking that string and Ucasing it. You need to close the Ucase before doing the comparison. Also you should be checking if they are not equal. So here is the corrected version of the offending code. Code:
<%If UCase(Request.Form("Validated")) <> "VALIDATED" Then%>
|
|
#7
|
|||
|
|||
|
I appreciate ALL your help with this DefJam, but nothing seems to
get this form mailed to either party!!! Your change made the form go blank once I hit the submit button. This is sooooo frustrating! I think we're missing something from the big picture here! Any last suggestions, before I give up? |
|
#8
|
|||
|
|||
|
Below is the updated code.
I have suspect feelings about the two lines I have made red. I noticed the <form> tag is opened but not closed "</form>", could this be the culprit? The 2nd line in red is the line that sends the email to the respective parties from the fields at the top of the form. Does everything look OK here? Code:
<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = true
Response.Expires = -1000
%>
<html>
<head>
<title>ESP - Certification - Multiple-Choice Questions</title>
<style type="text/css">
.button {border-style: inset;
border-color: #FAD2A2;
background-color: #FAD2A2;
width: 90px;
text-align: center;
font-family : Verdana;
font-weight: bold;
color : Black;
font-size: 10pt;
padding: 1px}
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" vlink="#800080" topmargin="0" leftmargin="0" onload="ChangeOn()" marginheight="0" marginwidth="0" link="#0000FF" alink="#FF0000">
<div id="main">
<table width="780" border="0" cellspacing="0" cellpadding="5" height="1" align="left">
<tr bgcolor="#FF909B">
<td width="725" height="6" valign="top" bgcolor="#FF9933">
<font face="Verdana, Arial, Helvetica, sans-serif" size="4"><b><i>CERTIFICATION</i></b></font>
</td>
</tr>
<tr bgcolor="#FFBFC6" valign="middle">
<td height="13" bgcolor="#FAD2A2">
<font face="Verdana, Arial, Helvetica, sans-serif" size="4"><b><i>MULTIPLE CHOICE
QUESTIONS</i></b></font>
</td>
</tr>
<tr>
<td valign="top" height="1">
<!-- ------------ INPUT FIELDS START -------------------------------------------------------------------------------------------------- -->
<!-- BELOW ARE THE 3 REQUIRED FIELDS THE USER MUST FILL IN IN ORDER TO SEND THE FORM -->
<%If UCase(Request.Form("Validated")) <> "VALIDATED" Then%>
<form method="POST" action="<%= Request.ServerVariables("Script_Name")%>" name="frmMain">
<input type="hidden" name="Validated" id="Validated" value="" />
<input TYPE="hidden" NAME="frmMain" VALUE="0">
<font face="Verdana, Arial, Helvetica, sans-serif" size="3">Please enter your name and the email address of yourself and your manager.</font>
<br>
<br>
<!-- 1ST FIELD IS THE USERS FULL NAME ---------------------------------------------------------------------------------------------- -->
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Name</font>
<font size="1">
<br>
<input type="text" name="name" size="30" style="font-family: Verdana; font-size: 10px">
<br>
</font>
</font><br><br>
<!-- 2ND FIELD IS THE USERS EMAIL ADDRESS --------------------------------------------------------------------------------------- -->
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Your Email</font>
<font size="1">
<br>
<input type="text" name="email" size="30" style="font-family: Verdana; font-size: 10px">
<br>
</font>
</font><br><br>
<!-- 3RD FIELD IS THE USERS MANAGERS EMAIL ADDRESS ------------------------------------------------------------------------- -->
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Managers Email</font>
<font size="1">
<br>
<input type="text" name="manager" size="30" style="font-family: Verdana; font-size: 10px">
<br>
</font>
</font><br><br>
<!-- ONCE THE USER HITS THE SUBMIT BUTTON AT THE BOTTOM OF THE PAGE, THE FORM SHOULD BE SENT
TO THE EMAIL ADDRESSES THE USER INPUT IN THE ABOVE 2 FIELDS-->
<!-- ------------ INPUT FIELDS END ------------------------------------------------------------------------------------------------------ -->
<!-- ------------ BODY OF FORM START ------------------------------------------------------------------------------------------------- -->
</font></span><font size="2"><span style="font-family: Verdana"><b>1. A Sales
Competitor Analysis allows you to:</b><br>
</span></font><span lang="en-us"><font size="2">
<span style="font-family: Verdana"><input type="radio" value="V1" name="R1">a)
Forecast future business<br>
</span></font><span style="font-size: 12.0pt; font-family: Times New Roman">
<font size="2"><span style="font-family: Verdana">
<input type="radio" name="R1" value="V2">b) Talk negatively about your
competitors<br>
<input type="radio" name="R1" value="V3">c) Identify where needs are likely to
be found<br>
<input type="radio" name="R1" value="V4">d) Position your products<br>
</span></font></span></span></p>
<p class="MsoBodyText"><font size="2" face="Verdana"><b>2. Which of the
following is least important in determining how to position your
products/service?</b><br>
</font><font face="Verdana"><input type="radio" name="R2" value="V1"><span lang="en-us"><font size="2">a)
</font></span><font size="2">Identify those areas where you are strong and the
competitor is weak.<br>
</font><input type="radio" name="R2" value="V2"><span lang="en-us"><font size="2">b)
</font></span><font size="2">Identify the customer’s needs and how they are
currently being met.<br>
</font><input type="radio" name="R2" value="V3"><span lang="en-us"><font size="2">c)
</font></span><font size="2">Identify those areas in which you can
differentiate yourself from the competition.<br>
</font></font><span style="font-size: 12.0pt; font-family: Verdana">
<input type="radio" name="R2" value="V4"></span><span style="font-family: Verdana"><span lang="en-us"><font size="2">d)
</font></span><font size="2">Identify the decision-makers within the
customer’s institute.<br>
</font></span></p>
<!-- ------------ BODY OF FORM END ---------------------------------------------------------------------------------------------------- -->
<!-- ------------ SUBMIT BUTTON START ----------------------------------------------------------------------------------------------- -->
<div align="center">
<a href="java script:DoSubmit()" class="button" style="text-decoration: none">
<font size="1">SUBMIT</font>
</a>
</div>
<!-- ------------ SUBMIT BUTTON END -------------------------------------------------------------------------------------------------- -->
<%else SendEmailMessage()%>
</td>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
<%End If%>
<!-- ------------ SEND MAIL CODE START ---------------------------------------------------------------------------------------------- -->
<%
Sub SendEmailMessage()
Dim objMail
Dim strBody
Set objMail= CreateObject("CDONTS.Newmail")
strBody = "<HTML>"
strBody = strBody &"<HEAD>"
strBody = strBody &"<STYLE>TD{FONT-SIZE:x-small;FONT-FAMILY:Arial}.B {font-weight:700;}.BL {font-weight:700;FONT-SIZE:small;}</STYLE>"
strBody = strBody & "</HEAD><BODY>"
strBody = strBody & "<TABLE WIDTH='100%' CELLPADDING='0'>"
strBody = strBody & "<tr><td> </td></tr>"
strBody = strBody & "<tr><td>"
strBody = StrBody & "<strong><h4>ESP Certification Results</h4></strong>" & chr(10)
strBody = strBody & "</td></tr>"
strBody = strBody & "<tr><td>"
strBody = StrBody & "<strong>Name: </strong>" & Request.Form("name") & chr(10)
strBody = strBody & "</td></tr>"
strBody = strBody & "<tr><td>"
strBody = StrBody & "<strong>Email: </strong>" & Request.Form("email") & chr(10)
strBody = strBody & "</td></tr>"
strBody = strBody & " "
strBody = strBody & "</TABLE>"
strBody = strBody & "</BODY>"
objMail.BodyFormat = 0'HTML
objMail.Body = strBody
objMail.MailFormat = 0'Mime format
objMail.Importance = 2'High
objMail.From = "ESP User"
objMail.To = Request.Form("manager") & ", " & Request.Form("name") & "<" & Request.Form("email") & ">"
objMail.Subject = "ESP User Certification Results"
objMail.Send
Set objMail = Nothing
End Sub
%>
<!-- ------------ SEND MAIL CODE END ------------------------------------------------------------------------------------------------- -->
<!-- ------------ ERROR POP-UP START ------------------------------------------------------------------------------------------------- -->
<script Language="Javascript">
function DoSubmit()
{
if(frmMain.name.value=="")
{
window.alert("Your Name is required before submission");
}
else
{
frmMain.Validated.value = 'Validated';
frmMain.submit()
}
}
</script>
<!-- ------------ ERROR POP-UP END ---------------------------------------------------------------------------------------------------- -->
|
|
#9
|
|||
|
|||
|
Don't give up you almost have it.
Basicly you just need to clean up a few things. I'm at school right now so I don't really have the ablity to do much work with your code. But just looking it over I spotted this (actually I spotted it last time but just forgot to update it for you). Code:
<%else SendEmailMessage()%>
</td>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
<%End If%>
You need to have the else code be after all of you closing tags other wise they will not be displayed until else is true. Also it does appear that you forgot your closing form tag so that too will need to be put into the above code. I'm not going to be much help to you with the actual sending of emails as I have never done it before. I do have one suggestion though, why don't you try sending just a staic email don't try anything fancy just see if you can get it to work with a static message and email address. If you can get it to send then you can try to make it all snazzy with dynamic bits and such. Anyway here is the corrected bit of code. Code:
</td>
</table>
</td>
</tr>
</table>
</div>
</form> <!-- closing form tag -->
</body>
</html>
<%else SendEmailMessage()%> 'by moving this here all the html is closed correctly
<%End If%>
Code:
<%
Sub SendEmailMessage()
Dim objMail
Dim strBody
Response.write("We have made it into the email sub<br>Let's check the address that we are sending to...")
Response.write(Request.Form("manager") & ", " & Request.Form("name") & "<" & Request.Form("email") & ">")
Reponse.write("well does this look correct?")
Try putting those changes in see what happens. If I get a chance today I'll look over everything in depth (maybe while I'm at work ). Good luck and don't give up. |
|
#10
|
|||
|
|||
|
PROGRESS DEFJAM!!!
![]() Below is what I get after I hit submit: Code:
We have made it into the email sub Let's check the address that we are sending to... manager@dtgrafx.com, user@dtgrafx.com Microsoft VBScript runtime error '800a01f4' Variable is undefined: 'Reponse' /rsoamericas/esp/html/8_Cert/Cert_1.asp, line 625 I've changed your code a bit to return the appropriate email addresses. Unfortunately nothing gets emailed to them. Code:
Response.write(Request.Form("manager") & ", " & Request.Form("email"))
Thanks for not giving up on me man... Last edited by dtgrafx : May 6th, 2003 at 03:12 PM. |
|
#11
|
|||
|
|||
|
Quote:
Well it looks like my amazing typing skills have caused an error. I corrected my typo so the code should run correctly now. Code:
<%
Sub SendEmailMessage()
Dim objMail
Dim strBody
Response.write("We have made it into the email sub<br>Let's check the address that we are sending to...")
Response.write(Request.Form("manager") & ", " & Request.Form("email"))
Response.write("well does this look correct?")
|
|
#12
|
|||
|
|||
|
you see what this thing is doing to me!
I can't even spot a syntax error... sheesh ![]() I'll let you know how it goes in a few. It's ok now! So how do I get the answers the user checked off in the form to get emailed to the addresses input by the user at the top of the form? That question is the bane of my existance right about now ![]() Last edited by dtgrafx : May 7th, 2003 at 12:13 PM. |