0

I am working on HTML form that will send email via email client on my page. Issue is when I press send button, it opens my default email client but it also imports all labels inside. Is there a way to avoid importing labels? As you can see on attached screenshot: enter image description here

Also this is HTML code I've been using for this :

 <body>
<div id="wrapper">
  <table>
    <tr>
      <td class="banner"><img src="images/test_500.png" width="499" height="161" alt="test"></td>
    </tr>
    <tr>
      <td id="content"><!-- p class="font155"> TEST PAGE</p -->
        <p>CONTACT US</p>
        <div id="form-div">
        <form method="post" action="mailto:john@doe.com?subject=Email subscription for test" enctype="text/plain">
          <label>Subject</label><br />
          <input type="text" name="Subject" value="" size="40" />
          <br />
          <br />
          <label for="name">Name</label><br />
          <input type="text" name="Name" size="40">
          <br />
          <br />
          <label for="email">E-mail</label><br />
          <input  type="email" name="Email" size="40">
          <br />
          <br />
          <label for="comment">Comment</label><br />
          <textarea  name="Comment" rows="5" cols="40"></textarea>
          <br />
          <br />
          <input type="submit" value="Send">
          <!-- input type="reset" value="Reset" -->
        </form>
        </div>
        </td>
    </tr>
    <tr>
      <td><!-- hr / --></td>
    </tr>
  </table>
</div>
<!-- End Save for Web Slices -->
</body>
Michael
  • 199
  • 2
  • 16

1 Answers1

1

You can use JS(in my case jQuery lib also) to do it, just add this code:

$(function() {
  $('form').submit(function(e) {
    e.preventDefault();

    var action = $(this).attr('action');
    var msg = '';

    $(this).find('input, textarea').not('[type=submit]').each(function(i, el) {
      msg += el.value; //here you can add break line(%0D%0A) or delimeter
    });

    if (msg) {
      var link = action + '&body=' + msg;
      location.href = action + '&body=' + msg;
      //window.open(link, '_blank'); //if you need open new window
    }
  });
});
Suleiman
  • 1,003
  • 2
  • 15
  • 29