Bill Sullivan
asked on
Form Email Submission in Java Script
What is wrong with my Java Script code on the attached? I want the program to send two emails if certain parameters are true and one email if other parameters are true. The program runs without sending back an error, but does not send the email.
The following is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Kaizen Work Order</title>
<style type="text/css">
<!--
.style1 {
color: #339966;
font-weight: bold;
}
.style2 {
font-size: small;
font-weight: bold;
}
.style4 {color: #0000FF}
.style6 {font-size: small}
.style7 {font-size: medium}
a:link {
color: #0000FF;
}
a:visited {
color: #0000FF;
}
a:hover {
color: #0000FF;
}
a:active {
color: #0000FF;
}
body {
background-image: url(maint button pictures/chalk.jpg);
background-image: url(maint%20button%20pictu res/chalk. jpg);
}
.style8 {
color: #068E55;
font-weight: bold;
font-size: large;
}
.style9 { font-size: large;
font-weight: bold;
}
-->
</style>
<script>
function SubmitAndRedirect()
{
document.form1.submit();
location.href = "kaizan_thank_you.htm";
}
</script>
</head>
<body><html>
<body>
<table width="700" border="0" align="center">
<tr>
<td><div align="center">
<p class="style1"><img src="maint button pictures/fluke.gif" width="151" height="45" /></p>
</div></td>
</tr>
</table>
<table width="700" border="0" align="center">
<tr>
<td width="686"><div align="center" class="style9">Kaizen Work Order </div>
<hr /></td>
</tr>
</table>
<br />
<form name="form1" id="form1">
<script type="text/javascript">
if _POST(120_w/o_air = "checkbox")
{
<form action="MAILTO:bill.sulliv an@mac.com , bsullivan@northlakecc.org? subject=Ka izen Support Request" method="post" enctype="text/plain">
}
else if (b = "checkbox")
{
<form action="MAILTO:bill.sulliv an@mac.com , bsullivan@northlakecc.org? subject=Ka izen Support Request" method="post" enctype="text/plain">
}
else if (c = "checkbox")
{
<form action="MAILTO:bill.sulliv an@mac.com , bsullivan@northlakecc.org? subject=Ka izen Support Request" method="post" enctype="text/plain">
}
else if (d = "checkbox")
{
<form action="MAILTO:bill.sulliv an@mac.com , bsullivan@northlakecc.org? subject=Ka izen Support Request" method="post" enctype="text/plain">
}
else if (e = "checkbox")
{
<form action="MAILTO:bill.sulliv an@mac.com , bsullivan@northlakecc.org? subject=Ka izen Support Request" method="post" enctype="text/plain">
}
else if (f = "checkbox")
{
<form action="MAILTO:bill.sulliv an@mac.com , bsullivan@northlakecc.org? subject=Ka izen Support Request" method="post" enctype="text/plain">
}
else if (g = "checkbox")
{
<form action="MAILTO:bill.sulliv an@mac.com , bsullivan@northlakecc.org? subject=Ka izen Support Request" method="post" enctype="text/plain">
}
else
{
<form action="MAILTO:bill.sulliv an@mac.com ?subject=K aizen Support Request" method="post" enctype="text/plain">
}
</script>
<table width="700" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="221"><span class="style7">Today's Date: </span></td>
<td colspan="4"><span class="style7">
<label>
<input name="Today_Date" type="text" id="Today_Date" />
</label>
</span></td>
</tr>
<tr>
<td><span class="style7">Requestor Name:</span></td>
<td colspan="4"><span class="style7">
<input name="Requestor_Name" type="text" id="Requestor_Name" />
</span></td>
</tr>
<tr>
<td><span class="style7">Phone:</spa n></td>
<td colspan="4"><span class="style7">
<input name="Phone" type="text" id="Phone" />
</span></td>
</tr>
<tr>
<td><span class="style7">Charter Name: </span></td>
<td colspan="4"><span class="style7">
<input name="Charter_Name" type="text" id="Charter_Name" />
</span></td>
</tr>
<tr>
<td><span class="style7">Building</s pan></td>
<td width="81"><input name="Park" type="checkbox" id="Park" value="checkbox" />
Park </td>
<td width="83"><input name="EW" type="checkbox" id="EW" value="checkbox" />
EW </td>
<td width="102"><input name="Plastics" type="checkbox" id="Plastics" value="checkbox" />
Plastics </td>
<td width="181"><input name="CSS" type="checkbox" id="CSS" value="checkbox" />
CSS </td>
</tr>
<tr>
<td>Sub-Location:</td>
<td colspan="4"><input name="Sub-Location" type="text" id="Sub-Location" /></td>
</tr>
<tr>
<td><span class="style7">Cost Center: </span></td>
<td colspan="4"><span class="style7">
<input name="Cost_Center" type="text" id="Cost_Center" />
</span></td>
</tr>
<tr>
<td><span class="style7">Start Date: </span></td>
<td colspan="4"><span class="style7">
<input name="Start_Date" type="text" id="Start_Date" />
</span></td>
</tr>
<tr>
<td>Finish Date: </td>
<td colspan="4"><span class="style7">
<input name="Finish_Date" type="text" id="Finish_Date" />
</span></td>
</tr>
<tr>
<td colspan="5"><span class="style7">Description of Services (will automatically notify Facilities Design/Engineering. Contact IT directly): </span><span class="style7"></span></td >
</tr>
<tr>
<td> </td>
<td colspan="2"><div align="center">yes</div></ td>
<td><div align="center">no</div></t d>
<td>Quantity</td>
</tr>
<tr>
<td>Work Benches: </td>
<td colspan="2">
<div align="center">
<input name="wb_yes" type="checkbox" id="wb_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="wb_no" type="checkbox" id="wb_no" value="checkbox" />
</div></td>
<td><input name="wb_quan" type="text" id="wb_quan" size="6" /></td>
</tr>
<tr>
<td>Inventory Center: </td>
<td colspan="2"><div align="center">
<input name="IC_yes" type="checkbox" id="IC_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="IC_no" type="checkbox" id="IC_no" value="checkbox" />
</div></td>
<td><input name="IC_quan" type="text" id="IC_quan" size="6" /></td>
</tr>
<tr>
<td>Other Benches/Carts: </td>
<td colspan="2"><div align="center">
<input name="Other_Equip_yes" type="checkbox" id="Other_Equip_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="Other_Equip_no" type="checkbox" id="Other_Equip_no" value="checkbox" />
</div></td>
<td><input name="Other_Equip_quan" type="text" id="Other_Equip_quan" size="6" /></td>
</tr>
<tr>
<td>120 Volt Cord Drops w/o Compressed Air: </td>
<td colspan="2"><div align="center">
<input name="120_w/o_air_yes" type="checkbox" id="120_w/o_air_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="120_w/o_air_no" type="checkbox" id="120_w/o_air_no" value="checkbox" />
</div></td>
<td><input name="120_w/o_air_quan" type="text" id="120_w/o_air_quan" size="6" /></td>
</tr>
<tr>
<td>120 Volt Cord Drops w/ Compressed Air: </td>
<td colspan="2"><div align="center">
<input name="120_w_air_yes" type="checkbox" id="120_w_air_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="120_w_air_no" type="checkbox" id="120_w_air_no" value="checkbox" />
</div></td>
<td><input name="120_w_air_quan" type="text" id="120_w_air_quan" size="6" /></td>
</tr>
<tr>
<td>Separate Compressed Air Drops: </td>
<td colspan="2"><div align="center">
<input name="air_yes" type="checkbox" id="air_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="air_no" type="checkbox" id="air_no" value="checkbox" />
</div></td>
<td><input name="air_quan" type="text" id="air_quan" size="6" /></td>
</tr>
<tr>
<td>Other Electrical (208V, 460V, 3 Phase, etc.) </td>
<td colspan="2"><div align="center">
<input name="othe_elec_yes" type="checkbox" id="othe_elec_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="other_elec_no" type="checkbox" id="other_elec_no" value="checkbox" />
</div></td>
<td><input name="other_elec_desc" type="text" id="other_elec_desc" size="20" /></td>
</tr>
<tr>
<td>Water Supply: </td>
<td colspan="2"><div align="center">
<input name="water_yes" type="checkbox" id="water_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="water_no" type="checkbox" id="water_no" value="checkbox" />
</div></td>
<td><input name="water_quan" type="text" id="water_quan" size="6" /></td>
</tr>
<tr>
<td>DI Water: </td>
<td colspan="2"><div align="center">
<input name="DI_yes" type="checkbox" id="DI_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="DI_no" type="checkbox" id="DI_no" value="checkbox" />
</div></td>
<td><input name="DI_quan" type="text" id="DI_quan" size="6" /></td>
</tr>
<tr>
<td>Ventilation Requirements: </td>
<td colspan="2"><div align="center">
<input name="vent_yes" type="checkbox" id="vent_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="vent_no" type="checkbox" id="vent_no" value="checkbox" />
</div></td>
<td><input name="vent_desc" type="text" id="vent_desc" size="20" /></td>
</tr>
<tr>
<td colspan="5">Special Considerations: </td>
</tr>
<tr>
<td colspan="5"><span class="style6"></span><spa n class="style6">
<textarea name="Description" cols="60" rows="10" id="Description"></textare a>
</span></td>
</tr>
<tr>
<td colspan="5"><div align="center"><span class="style6"></span><spa n class="style6">
<input type="button" onclick="SubmitAndRedirect ()" value="Submit" />
</span>
<input name="Reset" type="reset" id="Reset" value="Reset" />
</div></td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
</body>
</html>
The following is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Kaizen Work Order</title>
<style type="text/css">
<!--
.style1 {
color: #339966;
font-weight: bold;
}
.style2 {
font-size: small;
font-weight: bold;
}
.style4 {color: #0000FF}
.style6 {font-size: small}
.style7 {font-size: medium}
a:link {
color: #0000FF;
}
a:visited {
color: #0000FF;
}
a:hover {
color: #0000FF;
}
a:active {
color: #0000FF;
}
body {
background-image: url(maint button pictures/chalk.jpg);
background-image: url(maint%20button%20pictu
}
.style8 {
color: #068E55;
font-weight: bold;
font-size: large;
}
.style9 { font-size: large;
font-weight: bold;
}
-->
</style>
<script>
function SubmitAndRedirect()
{
document.form1.submit();
location.href = "kaizan_thank_you.htm";
}
</script>
</head>
<body><html>
<body>
<table width="700" border="0" align="center">
<tr>
<td><div align="center">
<p class="style1"><img src="maint button pictures/fluke.gif" width="151" height="45" /></p>
</div></td>
</tr>
</table>
<table width="700" border="0" align="center">
<tr>
<td width="686"><div align="center" class="style9">Kaizen Work Order </div>
<hr /></td>
</tr>
</table>
<br />
<form name="form1" id="form1">
<script type="text/javascript">
if _POST(120_w/o_air = "checkbox")
{
<form action="MAILTO:bill.sulliv
}
else if (b = "checkbox")
{
<form action="MAILTO:bill.sulliv
}
else if (c = "checkbox")
{
<form action="MAILTO:bill.sulliv
}
else if (d = "checkbox")
{
<form action="MAILTO:bill.sulliv
}
else if (e = "checkbox")
{
<form action="MAILTO:bill.sulliv
}
else if (f = "checkbox")
{
<form action="MAILTO:bill.sulliv
}
else if (g = "checkbox")
{
<form action="MAILTO:bill.sulliv
}
else
{
<form action="MAILTO:bill.sulliv
}
</script>
<table width="700" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="221"><span class="style7">Today's Date: </span></td>
<td colspan="4"><span class="style7">
<label>
<input name="Today_Date" type="text" id="Today_Date" />
</label>
</span></td>
</tr>
<tr>
<td><span class="style7">Requestor Name:</span></td>
<td colspan="4"><span class="style7">
<input name="Requestor_Name" type="text" id="Requestor_Name" />
</span></td>
</tr>
<tr>
<td><span class="style7">Phone:</spa
<td colspan="4"><span class="style7">
<input name="Phone" type="text" id="Phone" />
</span></td>
</tr>
<tr>
<td><span class="style7">Charter Name: </span></td>
<td colspan="4"><span class="style7">
<input name="Charter_Name" type="text" id="Charter_Name" />
</span></td>
</tr>
<tr>
<td><span class="style7">Building</s
<td width="81"><input name="Park" type="checkbox" id="Park" value="checkbox" />
Park </td>
<td width="83"><input name="EW" type="checkbox" id="EW" value="checkbox" />
EW </td>
<td width="102"><input name="Plastics" type="checkbox" id="Plastics" value="checkbox" />
Plastics </td>
<td width="181"><input name="CSS" type="checkbox" id="CSS" value="checkbox" />
CSS </td>
</tr>
<tr>
<td>Sub-Location:</td>
<td colspan="4"><input name="Sub-Location" type="text" id="Sub-Location" /></td>
</tr>
<tr>
<td><span class="style7">Cost Center: </span></td>
<td colspan="4"><span class="style7">
<input name="Cost_Center" type="text" id="Cost_Center" />
</span></td>
</tr>
<tr>
<td><span class="style7">Start Date: </span></td>
<td colspan="4"><span class="style7">
<input name="Start_Date" type="text" id="Start_Date" />
</span></td>
</tr>
<tr>
<td>Finish Date: </td>
<td colspan="4"><span class="style7">
<input name="Finish_Date" type="text" id="Finish_Date" />
</span></td>
</tr>
<tr>
<td colspan="5"><span class="style7">Description
</tr>
<tr>
<td> </td>
<td colspan="2"><div align="center">yes</div></
<td><div align="center">no</div></t
<td>Quantity</td>
</tr>
<tr>
<td>Work Benches: </td>
<td colspan="2">
<div align="center">
<input name="wb_yes" type="checkbox" id="wb_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="wb_no" type="checkbox" id="wb_no" value="checkbox" />
</div></td>
<td><input name="wb_quan" type="text" id="wb_quan" size="6" /></td>
</tr>
<tr>
<td>Inventory Center: </td>
<td colspan="2"><div align="center">
<input name="IC_yes" type="checkbox" id="IC_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="IC_no" type="checkbox" id="IC_no" value="checkbox" />
</div></td>
<td><input name="IC_quan" type="text" id="IC_quan" size="6" /></td>
</tr>
<tr>
<td>Other Benches/Carts: </td>
<td colspan="2"><div align="center">
<input name="Other_Equip_yes" type="checkbox" id="Other_Equip_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="Other_Equip_no" type="checkbox" id="Other_Equip_no" value="checkbox" />
</div></td>
<td><input name="Other_Equip_quan" type="text" id="Other_Equip_quan" size="6" /></td>
</tr>
<tr>
<td>120 Volt Cord Drops w/o Compressed Air: </td>
<td colspan="2"><div align="center">
<input name="120_w/o_air_yes" type="checkbox" id="120_w/o_air_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="120_w/o_air_no" type="checkbox" id="120_w/o_air_no" value="checkbox" />
</div></td>
<td><input name="120_w/o_air_quan" type="text" id="120_w/o_air_quan" size="6" /></td>
</tr>
<tr>
<td>120 Volt Cord Drops w/ Compressed Air: </td>
<td colspan="2"><div align="center">
<input name="120_w_air_yes" type="checkbox" id="120_w_air_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="120_w_air_no" type="checkbox" id="120_w_air_no" value="checkbox" />
</div></td>
<td><input name="120_w_air_quan" type="text" id="120_w_air_quan" size="6" /></td>
</tr>
<tr>
<td>Separate Compressed Air Drops: </td>
<td colspan="2"><div align="center">
<input name="air_yes" type="checkbox" id="air_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="air_no" type="checkbox" id="air_no" value="checkbox" />
</div></td>
<td><input name="air_quan" type="text" id="air_quan" size="6" /></td>
</tr>
<tr>
<td>Other Electrical (208V, 460V, 3 Phase, etc.) </td>
<td colspan="2"><div align="center">
<input name="othe_elec_yes" type="checkbox" id="othe_elec_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="other_elec_no" type="checkbox" id="other_elec_no" value="checkbox" />
</div></td>
<td><input name="other_elec_desc" type="text" id="other_elec_desc" size="20" /></td>
</tr>
<tr>
<td>Water Supply: </td>
<td colspan="2"><div align="center">
<input name="water_yes" type="checkbox" id="water_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="water_no" type="checkbox" id="water_no" value="checkbox" />
</div></td>
<td><input name="water_quan" type="text" id="water_quan" size="6" /></td>
</tr>
<tr>
<td>DI Water: </td>
<td colspan="2"><div align="center">
<input name="DI_yes" type="checkbox" id="DI_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="DI_no" type="checkbox" id="DI_no" value="checkbox" />
</div></td>
<td><input name="DI_quan" type="text" id="DI_quan" size="6" /></td>
</tr>
<tr>
<td>Ventilation Requirements: </td>
<td colspan="2"><div align="center">
<input name="vent_yes" type="checkbox" id="vent_yes" value="checkbox" />
</div></td>
<td><div align="center">
<input name="vent_no" type="checkbox" id="vent_no" value="checkbox" />
</div></td>
<td><input name="vent_desc" type="text" id="vent_desc" size="20" /></td>
</tr>
<tr>
<td colspan="5">Special Considerations: </td>
</tr>
<tr>
<td colspan="5"><span class="style6"></span><spa
<textarea name="Description" cols="60" rows="10" id="Description"></textare
</span></td>
</tr>
<tr>
<td colspan="5"><div align="center"><span class="style6"></span><spa
<input type="button" onclick="SubmitAndRedirect
</span>
<input name="Reset" type="reset" id="Reset" value="Reset" />
</div></td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
</body>
</html>
Mailto: will probably just open the default e-mail client, I don't think it will send the e-mail too.
ASKER
In other subroutines where there is not an "if else if" variable, mailto both opens the client and sends the email. Besides, in this one, it doesn't even open the mail client - it just gives the "thank you" page.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.