Jump to content

Research email generator


stlwellj

Recommended Posts

I have a form that an agent can fill out and then hit send and it will auto generate an email for them. I had it working and wanted to update to dynamic drop downs. now my clear and send buttons no longer work. 

<head>
<title>Research / Serviceability Email</title>
 
<style type="text/css">
.style166 {color: #FFFFFF}
</style>
 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 
<script type="text/javascript">
        function clearresearch() {
                document.getElementById("text-one").selectedIndex = "base";
                document.getElementById('esl').value='';
                document.getElementById('account').value='';
                document.getElementById('name').value='';
                document.getElementById('address').value='';
                document.getElementById('er').value='';
                document.getElementById('issue').value='';
                document.getElementById("text-two").selectedIndex = "";
        }
 function mailresearch() {
        if (document.getElementById('txet-one').value="research") {
                var esl = document.getElementById('esl').value;
                var acct = document.getElementById('account').value;
                var name = document.getElementById('name').value;
                var address = document.getElementById('address').value;
                var er = document.getElementById('er').value;
                var issue = document.getElementById('issue').value;
                var type = document.getElementById('type').value;
                var sendmail = 'mailto:Email Address 1' + '?subject=' + esl + " / " + "ER" + er + " / " + type + '&body=' + "Account Number: " + acct + "%0D%0A" + "Customer Name: " + name + "%0D%0A" + "Customer Address: " + address + "%0D%0A" + "ER Ticket Number and Type: " + er + " / " + type + "%0D%0A%0D%0A" + "Description of Issue:" + "%0D%0A%0D%0A" + issue + "%0D%0A%0D%0A";
               
                win = window.open(sendmail, 'emailWindow');
    if (win && win.open && !win.closed) win.close();
                        }
                        else {
                var esl = document.getElementById('esl').value;
                var acct = document.getElementById('account').value;
                var name = document.getElementById('name').value;
                var address = document.getElementById('address').value;
                var er = document.getElementById('er').value;
                var issue = document.getElementById('issue').value;
                var type = document.getElementById('type').value;
                var sendmail = 'mailto:Email Address2' + '?subject=' + esl + " / " + "ER" + er + " / " + type + '&body=' + "Account Number: " + acct + "%0D%0A" + "Customer Name: " + name + "%0D%0A" + "Customer Address: " + address + "%0D%0A" + "ER Ticket Number and Type: " + er + " / " + type + "%0D%0A%0D%0A" + "Description of Issue:" + "%0D%0A%0D%0A" + issue + "%0D%0A%0D%0A";
               
                win = window.open(sendmail, 'emailWindow');
    if (win && win.open && !win.closed) win.close();
                        }
        }
 
$(function() {
        $("#text-one").change(function() {
        $("#text-two").load("textdata/" + $(this).val() + ".txt");
                        });
                });
 
</script>
 
</head>
<body>
<form name="research">
<table id="callnotesr">
<tbody>
<tr>
    <td bgcolor="#0000FF"><div align="center" class="style166">Research / Serviceability Email</div></td>
  </tr>
   <tr><td width="235" rowspan="5" valign="top" style="border:1px solid black; border-color:black;">
     <div>
                        <div align="">Research or Serviceability</div>
        <select id="text-one">
                        <option selected value="base">Please Select</option>
                        <option value="research">Research</option>
                        <option value="service">Serviceability</option>
                </select>
      </div>
        <div>
                                <div align="">ESL Ticket Number</div>
                                <div align="">
                                <input type="text" class="style44" id="esl" size="60" value="" >
</div>
        <div>
                                <div align="">Account Number</div>
                                <div align="">
                                <input type="text" class="style44" id="account" size="60" value="" >
</div>
        <div>
                                <div align="">Customer Name</div>
                        <div align="">
                                <input type="text" class="style44" id="name" size="60" value="">
</div>
        <div>
                                <div align="">Customer Address</div>
                        <div align="">
                                <input type="text" class="style44" id="address" size="60" value="">
</div>
        <div>
                                <div align="">ER Ticket Number</div>
                        <div align="">
                                <input type="text" class="style44" id="er" size="60" value="">
</div>
        <div>
        <div align="">ER Ticket Type</div>
                <select id="text-two">
                        <option>Please choose from above</option>
                </select>
</div>
        <div>
                        <div align="">Description of Issue</div>
                <div align="center">
                        <textarea cols="50" rows="10" id="issue" ></textarea>
</div>
      <br />
  <div>
        </form>  <div align="center" class="style44">
        <button name="clearresearch" type="button" class="style115" id="clearresearch" onclick="clearresearch()" value="Clear">Clear</button>
        <button name="mail" type="button" class="style115 " id="mail" onclick="mailresearch()" value="Send">Send</button>
    </div>
</td>
</tr></tbody></table>
 </body>
 </html>
Link to comment
https://forums.phpfreaks.com/topic/296224-research-email-generator/
Share on other sites

It may help to know what changes were made that caused the script to break. Are you getting any JavaScript errors?

 

Note that you can right-click a page (on Windows) in Google Chrome and click "Inspect element" to view the Developer Tools panel. You can see if there are any JavaScript errors under the "Console" tab. Firefox and Internet Explorer also have a "Console" tab that can be accessed in the same way as Chrome. I'm just not as familiar with that feature in those browsers.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.