Solved

Form Email Submission in Java Script

Posted on 2007-04-05
3
388 Views
Last Modified: 2013-11-23
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%20pictures/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.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">
            }
      else if (b = "checkbox")
            {
                  <form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">
            }
      else if (c = "checkbox")
            {
                  <form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">
            }
      else if (d = "checkbox")
            {
                  <form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">
            }
      else if (e = "checkbox")
            {
                  <form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">
            }
      else if (f = "checkbox")
            {
                  <form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">
            }
      else if (g = "checkbox")
            {
                  <form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">
            }
      else
            {
                  <form action="MAILTO:bill.sullivan@mac.com?subject=Kaizen 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:</span></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</span></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>&nbsp;</td>
    <td colspan="2"><div align="center">yes</div></td>
    <td><div align="center">no</div></td>
    <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><span class="style6">
      <textarea name="Description" cols="60" rows="10" id="Description"></textarea>
    </span></td>
    </tr>
  <tr>
    <td colspan="5"><div align="center"><span class="style6"></span><span class="style6">
      <input type="button" onclick="SubmitAndRedirect()" value="Submit" />
    </span>
        <input name="Reset" type="reset" id="Reset" value="Reset" />
    </div></td>
    </tr>
</table>
<p>&nbsp;</p>
</form>
</body>
</html>

</body>
</html>
0
Comment
Question by:sully1958
3 Comments
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
Mailto: will probably just open the default e-mail client, I don't think it will send the e-mail too.
0
 

Author Comment

by:sully1958
Comment Utility
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.
0
 
LVL 5

Accepted Solution

by:
tbboyett earned 250 total points
Comment Utility
i'm not sure if it will work but you could try using the document.write

if _POST(120_w/o_air = "checkbox")
            {
                  document.write('<form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">');
            }
      else if (b = "checkbox")
            {
                  document.write('<form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">');
            }
      else if (c = "checkbox")
            {
                  document.write('<form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">');
            }
      else if (d = "checkbox")
            {
                  document.write('<form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">');
            }
      else if (e = "checkbox")
            {
                  document.write('<form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">');
            }
      else if (f = "checkbox")
            {
                  document.write('<form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">');
            }
      else if (g = "checkbox")
            {
                  document.write('<form action="MAILTO:bill.sullivan@mac.com, bsullivan@northlakecc.org?subject=Kaizen Support Request" method="post" enctype="text/plain">');
            }
      else
            {
                  document.write('<form action="MAILTO:bill.sullivan@mac.com?subject=Kaizen Support Request" method="post" enctype="text/plain">');
            }
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
computer science syllabus 3 52
mapShare challenge 13 68
groovy example issue 10 65
Strange loading of website behaviour 3 23
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now