Hi guys,
I have a form that accepts user input and sends the result to a specified emailbox. However, it stopped working suddenly after I reinstalled the frontpage server extension. It now resets itself after submit button is clicked, and nothing else happens. Could someone please take a look at the code for me? I changed the emailbox in the page to
test@hotmail.com.
<%
if Request.Querystring("isSubmitted") = "yes" then
Dim fname, lname
Dim objCDO
Pickup_Date = Request.Querystring("Pickup_Date")
Return_Date = Request.Querystring("Return_Date")
Pickup_Time = Request.Querystring("Pickup_Time")
Return_Time = Request.Querystring("Return_Time")
Reserving_Person = Request.Querystring("Reserving_Person")
Your_Branch = Request.Querystring("Your_Branch")
Internet_Access = Request.Querystring("Internet_Access")
Internet_Branch = Request.Querystring("Internet_Branch")
Equipment_Needed = Request.Querystring("Equipment_Needed")
Purpose = Request.Querystring("Purpose")
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
HTML = HTML & "<title>Request for Equipment Reservation</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""#FFFFFF"">"
HTML = HTML & "<p><strong>Request for Equipment Reservation<br>Technology Department"
HTML = HTML & "</strong></p>"
HTML = HTML & ""
HTML = HTML & "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""4""><tr><td width=""25%""><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"">"
HTML = HTML & "Equipment Pick-up Date:<span style=""mso-tab-count:3""></span></span></b></td><td width=""25%"">"
HTML = HTML & Pickup_Date
HTML = HTML & "</td><td width=""25%""><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"">Equipment Return Date:</span></b></td><td width=""25%"">"
HTML = HTML & Return_Date
HTML = HTML & "</td></tr><tr><td><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"">Equipment Pick-up Time:<span style=""mso-tab-count:3""> </span></span></b></td><td>"
HTML = HTML & Pickup_Time
HTML = HTML & "</td><td><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"">Equipment Return Time:</span></b></td><td>"
HTML = HTML & Return_Time
HTML = HTML & "</td></tr>"
HTML = HTML & "<tr><td><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"">Person Reserving the Equipment:</span></b></td><td>"
HTML = HTML & Reserving_person
HTML = HTML & "</td><td><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"">Branch:</span></b></td><td>"
HTML = HTML & Your_Branch
HTML = HTML & "</td></tr><tr><td><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"">Do you require Internet Access? </span></b></td><td>"
HTML = HTML & Internet_Access
HTML = HTML & "</td><td><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"">If yes, for which Branch:</span></b></td><td>"
HTML = HTML & Internet_Branch
HTML = HTML & "</td></tr><tr>"
HTML = HTML & "<td><b><span lang=""EN-US"" style=""font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial""><b style=""mso-bidi-font-weight:normal"">Equipment Needed: </b></span></b></td><td>"
HTML = HTML & Equipment_Needed
HTML = HTML & "</td><td></tr><tr><td><span style=""font-size: 10.0pt; mso-bidi-font-size: 12.0pt; font-family: Arial"" lang=""EN-US""><b>Purpose presentation, movie, etc):</b></span></td><td>"
HTML = HTML & Purpose
HTML = HTML & "</td></tr></table>"
HTML = HTML & "<p>[u]<strong>Responsibility</strong></u><br>"
HTML = HTML & "By signing below, you acknowledge receipt of all equipment described above and "
HTML = HTML & "accept responsibility for its safekeeping. You assert that you will take reasonable "
HTML = HTML & "precautions necessary to prevent damage to and theft of the equipment and that"
HTML = HTML & "you will return it by the due date so that it will be available for other employees to use.<br><br>[u]<strong>Long Term Assignment</strong></u><br>"
HTML = HTML & "Equipment assigned for long-term use is signed out to an individual, but is often only approved for use by the employee in a particular role or job position. When the employee#8217;s job or role changes, the equipment will need to be returned for use by other employees whose job or role requires the equipment.<br><br>"
HTML = HTML & "[u]<strong>Return and Reassignment</strong></u><br>"
HTML = HTML & "Equipment will not be considered to be returned until a member of the Technology Department physically accepts return of the equipment, checks it, then completes and signs the Equipment Return section on this document.<br><br>"
HTML = HTML & "After that, a new Equipment Sign-Out Sheet must be completed for the new assignee. Responsibility cannot be transferred from one assignee to another. <br>"
HTML = HTML & "Only after the Equipment has been returned can responsibility for it be assigned to another employee.<br><br>"
HTML = HTML & "<br>Member of Technology Department ----------------------------------------------------------------- <br>"
HTML = HTML & "<br>Person Accepting Equipment Responsibility ------------------------------------------------------- <br>"
HTML = HTML & "<p>Print Name: _____________________________________ </p>"
HTML = HTML & "<p><br>To Be Filled Out By Technology Only: </p>"
HTML = HTML & "<p>OCL Asset Tag(s)# Loaned Out: _____________________________________</p>"
HTML = HTML & "<p>Equipment Return Date and Time: _____________________________________<br>"
HTML = HTML & "<br>Person Accepting the Return---------------------------------------------------------------------- <br>"
HTML = HTML & "<br>Print Name______________________________________ </p><br><br>"
HTML = HTML & "<br>Laptop Accessories Checked______________________ </p><br><br>"
HTML = HTML & "<p>Items in need of repair or replacement:<br></p>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = "test@hotmail.com"
objCDO.To = "test@hotmail.com"
objCDO.Cc = ""
objCDO.Bcc = ""
objCDO.Subject = "Equipment Request Form"
objCDO.Body = HTML
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
objCDO.Send
ConfirmMsg = "Thanks for reserving our equipment!"
end if
%>
<html>
<head>
<title>Equipment Request Form</title>
<script language="JavaScript">
<!-- //Start hiding
//
// Package : JavaScript Assist Tools
// Programmer : R. Stolfa (rstolfa@yahoo.com)
// Module : autotab()
// SCCSid : %Z% %M% %I% %D%
//
// Purpose : autotab moves the browser focus to the "next" element
// once the current one is "full". Here the form name is
// set to "ABCDEF" so that you can change it easily
//
// Modification History:
// 19970731 Created
//
function autotab(fn, fl) {
var i;
var idx;
var next;
var docele;
idx = -1;
for (i = 0; i < document.form1.length; i ++) {
if (document.form1.elements[i].name == fn.name)
idx = i;
}
if (idx != -1) {
// Find the next 'field'
next = idx + 1;
if (next >= document.form1.length)
next = 0
// Figure out the length of the given element.
docele = document.form1.elements[idx].value;
if (docele.length == fl) {
document.form1.elements[next].focus();
}
}
}
// End hiding -->
function validRequired(formField,fieldLabel)
{
var result = true;
if (formField.value == "")
{
alert('Please enter a value for the "' + fieldLabel +'" field.');
formField.focus();
result = false;
}
return result;
}
function validCheckedRequired(formField,nameField,fieldLabe lName)
{
var result = true;
if (formField.checked)
{
if (nameField.value == "")
{
alert('Please enter a value for the "' + fieldLabelName +'" field.');
formField.focus();
result = false;
}
}
return result;
}
function validCheckedboxRequired(formField, fieldLabelName)
{
var result = true;
if (formField.value == "")
{ alert('Please enter a value for the "' + fieldLabelName +'" field.');
formField.focus();
result = false;
}
return result;
}
function validCheckedContactRequired(emailField,telField1,t elField2,telField3,emailLabelName,telLabelName)
{
var result = true;
if (emailField.value == "" && (telField1.value == "" || telField2.value == "" || telField3.value == ""))
{
alert('Please enter a value for the "' + emailLabelName + '" or "' + telLabelName +'" field. Area code has to be included if telephone number is filled.');
emailField.focus();
result = false;
}
return result;
}
function isEmailAddr(email)
{
var result = false;
var theStr = new String(email);
var index = theStr.indexOf("@");
if (index > 0)
{
var pindex = theStr.indexOf(".",index);
if ((pindex > index+1) && (theStr.length > pindex+1))
result = true;
}
return result;
}
function validEmail(formField,fieldLabel)
{
var result = true;
if ((formField.value.length > 0) && ((formField.value.length < 3) || !isEmailAddr(formField.value)) )
{
alert("Please enter a complete email address in the form:
yourname@yourdomain.com");
formField.focus();
result = false;
}
return result;
}
function validTel(emailField,formField,formField2,formField 3)
{
var result = true;
if (emailField.value == "" || formField.value.length > 0 || formField2.value.length > 0 || formField3.value.length > 0)
{
if ((formField.value.length < 3) || (formField2.value.length < 3) || (formField3.value.length < 4))
{
alert("Please enter a complete telephone number!");
formField.focus();
result = false;
}
}
return result;
}
function validateForm(theForm)
{
// Customize these calls for your form
// Start ------->
if (!validRequired(form1.Pickup_Date,"Pick-up Date"))
return false;
if (!validRequired(form1.Return_Date,"Return Date"))
return false;
if (!validRequired(form1.Pickup_Time,"Pickup Time"))
return false;
if (!validRequired(form1.Return_Time,"Return Time"))
return false;
if (!validRequired(form1.Reserving_Person,"Reserving Person"))
return false;
if (!validRequired(form1.Your_Branch,"Your Branch"))
return false;
if (!validRequired(form1.Internet_Access,"Internet Access"))
return false;
if (!validCheckedRequired(form1.Internet_Access,form1 .Internet_Branch,"for which branch"))
return false;
if (!validCheckedboxRequired(form1.Equipment_Needed," Equipment needed"))
return false;
if (!validRequired(form1.Purpose,"Purpose"))
return false;
/*if (!validCheckedContactRequired(form1.UserEmail,form 1.UserTel,form1.UserTel2,form1.UserTel3,"Email", "Telephone"))
return false;
if (!validEmail(form1.UserEmail,"Email Address"))
return false;
if (!validTel(form1.UserEmail,form1.UserTel,form1.Use rTel2,form1.UserTel3))
return false;
if (!validTel2(form1.UserEmail,form1.UserTel3))
return false;*/
// <--------- End
return true;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<% if ConfirmMsg <> "" then %>
<h2><%= ConfirmMsg %></h2>
<% end if %>
<p align="right"><a href="../index.htm">Back to Technology</a> | <a href="javascript
:top.close();">Close
Window</a></p>
<p align="center"><strong>THIS FORM IS CURRENTLY NOT WORKING.
PLEASE USE THE <a href="Call_4_Help.htm">HELPDESK REQUEST FORM</a> TO RESERVE EQUIPMENT . THANK YOU.
(Updated 2/16/06)</strong></p>
<p align="center"><strong>Request for Equipment Reservation</strong><br>
<strong>Technology Department</strong><br>
<strong>Ocean County Library</strong><br>
</p>
<form action="equip.asp" method="POST" name="form1" onSubmit="return validateForm(this)">
<table width="760" border="1" align="center" cellpadding="6" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#C0C0C0">
<tr>
<td width="190"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial">Equipment Pick-up Date:<span style="mso-tab-count:
3"> </span></span></b></td>
<td width="182"><input type="text" name="Pickup_Date" id="Pickup_Date" size="20"></td>
<td width="160"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial">Equipment Return Date:</span></b></td>
<td width="170"><input type="text" name="Return_Date" id="Return_Date" size="20"></td>
</tr>
<tr>
<td width="190"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial">Equipment Pick-up Time:<span style="mso-tab-count:
3"> </span></span></b></td>
<td width="182"><input type="text" name="Pickup_Time" id="Pickup_Time" size="20"></td>
<td width="160"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial">Equipment Return Time:</span></b></td>
<td width="170"><input name="Return_Time" type="text" id="Return_Time" size="20"></td>
</tr>
<tr>
<td width="190"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial">Person Reserving the Equipment:</span></b></td>
<td width="182"><input name="Reserving_Person" type="text" id="Reserving_Person" size="20"></td>
<td width="160"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial">Your Branch:</span></b></td>
<td width="170"><select name="Your_Branch" id="Your_Branch">
<option selected value="">---- Select One ----</option>
<option value="Barnegat">Barnegat</option>
<option value="Bay Head">Bay Head</option>
<option value="Beachwood">Beachwood</option>
<option value="Berkeley">Berkeley</option>
<option value="Brick">Brick</option>
<option value="Island Heights">Island Heights</option>
<option value="Jackson">Jackson</option>
<option value="Lacey">Lacey</option>
<option value="Lakewood">Lakewood</option>
<option value="Little Egg Harbor">Little Egg Harbor</option>
<option value="Long Beach Island">Long Beach Island</option>
<option value="Manchester">Manchester</option>
<option value="OutReach">OutReach</option>
<option value="Plumsted">Plumsted</option>
<option value="Printing & Graphics">Printing & Graphics</option>
<option value="Pt. Pleasant Beach">Pt. Pleasant Beach</option>
<option value="Pt. Pleasant Boro">Pt. Pleasant Boro</option>
<option value="Stafford">Stafford</option>
<option value="Toms River">Toms River</option>
<option value="Tuckerton">Tuckerton</option>
<option value="Upper Shores">Upper Shores</option>
<option value="Waretown">Waretown</option>
</select></td>
</tr>
<tr>
<td width="190" height="28"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial">Do you require Internet Access? <span style="mso-spacerun:yes"></span></span></b></td>
<td width="182"><p>
<label>
<input name="Internet_Access" type="radio" value="Yes">
Yes</label>
<br>
</p></td>
<td width="160"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial">If yes, for which Branch:</span></b></td>
<td width="170"><select name="Internet_Branch" id="Internet_Branch">
<option selected >---- Select One ----</option>
<option value="Barnegat">Barnegat</option>
<option value="Bay Head">Bay Head</option>
<option value="Beachwood">Beachwood</option>
<option value="Berkeley">Berkeley</option>
<option value="Bishop Lab">Bishop Lab</option>
<option value="Brick">Brick</option>
<option value="Island Heights">Island Heights</option>
<option value="Jackson">Jackson</option>
<option value="Lacey">Lacey</option>
<option value="Lakewood">Lakewood</option>
<option value="Little Egg Harbor">Little Egg Harbor</option>
<option value="Long Beach Island">Long Beach Island</option>
<option value="Manchester">Manchester</option>
<option value="OutReach">OutReach</option>
<option value="Plumsted">Plumsted</option>
<option value="Printing & Graphics">Printing & Graphics</option>
<option value="Pt. Pleasant Beach">Pt. Pleasant Beach</option>
<option value="Pt. Pleasant Boro">Pt. Pleasant Boro</option>
<option value="Stafford">Stafford</option>
<option value="Stafford Lab">Stafford Lab</option>
<option value="Toms River">Toms River</option>
<option value="Tuckerton">Tuckerton</option>
<option value="Upper Shores">Upper Shores</option>
<option value="Waretown">Waretown</option>
</select></td>
</tr>
<tr>
<td width="190"><b><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"><b style="mso-bidi-font-weight:normal">Equipment
</b><b style="mso-bidi-font-weight: normal; font-size: 10.0pt; mso-bidi-font-size: 12.0pt; font-family: Arial">Needed</b><b style="mso-bidi-font-weight:normal">:</b></span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial"></span></b></td>
<td colspan="3"><p>
<label>
<input type="checkbox" name="Equipment_Needed" id="Equipment_Needed" value="Laptop">
Laptop</label>
<label>
<input type="checkbox" name="Equipment_Needed" id="Equipment_Needed" value="Projector">
Projector</label>
<label>
<input type="checkbox" name="Equipment_Needed" id="Equipment_Needed" value="DVD Player">
DVD Player</label>
<input type="checkbox" name="Equipment_Needed" id="Equipment_Needed" value="Video Camera">
Video Camera </p></td>
</tr>
<tr>
<td width="190"><span style="font-size: 10.0pt; mso-bidi-font-size: 12.0pt; font-family: Arial" lang="EN-US"><b>Purpose
(presentation, movie, etc):</b></span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial"></span></td>
<td colspan="3"><p>
<textarea name="Purpose" id="textarea" rows="1" cols="20"></textarea>
&n bsp; &nbs p; &n bsp;
<input type="hidden" name="isSubmitted" value="yes">
<input type="submit" value="Submit Form">
</p></td>
</tr>
<tr bgcolor="#FFFFCC">
<td colspan="4"> <p align="left"><strong>Please refer to the following instructions
for filling out the form:</strong></p>
[list]
<li>Determine type of equipment to be reserved (from list below)</li>
<li> Refer to the Equipment Calendar (in the Outlook Technology Equipment
Request Folder) for availability of equipment</li>
<li> Fill in top section of form</li>
<li> Receipt of a confirmation email from the Technology Helpdesk confirms
that your request has been completed. (Please check Equipment Calendar
to confirm reservation date/info is correct)</li>
<li> Contact the Technology Dept. Helpdesk (x5411) to arrange pick-up
or drop-off of equipment</li>
<li> If showing a movie, please reserve the DVD/CD player along with
Digital Projector (no laptop is necessary) </li>
</ul>
<p>**Please notify the Technology Department of any missing or damaged
items when returning the equipment**<br>
</p>
<p align="left"><strong>The following is a list of available equipment:</strong><br>
Laptops: Only four laptops are available from Technology.<br>
Laptop 3 - Windows 2000; Office 2003; floppy drive; CD ROM; modem; network
card; 1 USB port<br>
Laptop 4 - Windows 2000; Office 2000; Horizon, PC Reliance, AOL 7.0;
floppy drive; CD ROM; 2 USB ports; modem; network card<br>
Laptop 5 - Windows XP; Office 2003; Horizon 7.3.2; (no floppy drive);
CD-RW/DVD Rom combos; modem; network card; 2 USB ports<br>
Laptop 7 - Windows XP; Office 2000; Horizon, PC Reliance, Camedia; Adobe
PhotoShop Elements 2.0; external floppy drive; CD-RW/DVD Rom combos;
modem; network card; 2 USB ports</p>
<p align="left"><strong>Other Equipment:</strong><br>
DVD/CD Player (1)<br>
Video Camera (1)<br>
Digital Projector (1)</p></td>
</tr>
</table>
</form>
<p align="left"> </p>
</body>
</html>