Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Form Email Submission in Java Script

Posted on 2007-04-05
3
Medium Priority
?
402 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18861211
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
ID: 18861226
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 750 total points
ID: 18861716
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

597 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