title: populating a field value based on the button clicked
body: <p>I have a html form with a hidden field and 2 submit buttons. Based on what button in clicked ( trial or buy) I need to set the promo code field ( with "trial" as promo code for trial button and "buy "as promo code for  buy button.</p>
  
  <p>I am not sure how I could read what button is clicked in java script. I have a java script already in place that is copying email ID into another field on hitting submit. I'd like integrate the java script with existing one.</p>
  
  <p>HTML code:</p>
  
  <pre><code>&lt;form&gt;Email:
      &lt;input type="text" name="email"&gt;
      &lt;br&gt;
      &lt;/label&gt;&lt;input type ="hidden" name="retype-email"&gt;
      &lt;br&gt;
  
      &lt;input type="hidden" name="PromoCode" value="" method="post"&gt;
  
      &lt;input class="Orange_button" type="submit" value="Start my free trial"&gt; 
      &lt;input class="green_button" type="submit" value="Buy it now"&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>JS Fiddle: <a href="http://jsfiddle.net/x1bdgvyt/3/" rel="nofollow">http://jsfiddle.net/x1bdgvyt/3/</a></p>