title: Required Entry for only one button of two
body: <p>I have a form that has a text field that is a required entry for one(1) of my two(2) buttons.  The first(1st) button applies a code, in the text field, to the products in the cart section of my store.  The second(2nd) removes all codes from all products in the cart section.</p>
  
  <p>What's the best way of going about this?</p>
  
  <p>Thx.</p>
  
  <pre><code>&lt;div id="cart-coupon-menu" class="coupon-menu-hide"&gt;
  &lt;form id="discount-coupon-form" action="&lt;?php echo $this-&gt;getUrl('checkout/cart/couponPost') ?&gt;" method="post"&gt;
      &lt;div class="discount"&gt;
          &lt;div class="discount-form"&gt;
              &lt;input type="hidden" name="remove" id="remove-coupone" value="0" /&gt;
              &lt;div class="input-box"&gt;
                  &lt;input class="input-text" id="coupon_code" name="coupon_code" value="&lt;?php echo $this-&gt;escapeHtml($this-&gt;getCouponCode()) ?&gt;" placeholder="Enter a Coupon or Promo Code" autocomplete="off"/&gt;
              &lt;/div&gt;
              &lt;div class="buttons-set"&gt;
                  &lt;button type="button" title="&lt;?php echo $this-&gt;__('Apply Coupon') ?&gt;" class="button" onclick="discountForm.submit(false)" value="&lt;?php echo $this-&gt;__('Apply Coupon') ?&gt;"&gt;&lt;span&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Apply Coupon') ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;
                  &lt;button type="button" title="&lt;?php echo $this-&gt;__('Cancel Coupon') ?&gt;" class="button" onclick="discountForm.submit(true)" value="&lt;?php echo $this-&gt;__('Cancel Coupon') ?&gt;"&gt;&lt;span&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Cancel Coupon') ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The above form will be serialized and set to a controller via AJAX and an appropriate response will be returned.</p>
  
  <p>When the input box is null I want the input box to act as a required field and disallow submission via the first button.  However, when it is null the second button should still allow for submission.  When text is entered into the input box they both behave normally.</p>
  
  <p>Currently i'm attempting to do something like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      //&lt;![CDATA[
      var discountForm = new VarienForm('discount-coupon-form');
      discountForm.submit = function (isRemove) {
          if (isRemove) {
              $('coupon_code').removeClassName('required-entry');
              $('remove-coupone').value = "1";
          } else {
              $('coupon_code').addClassName('required-entry');
              $('remove-coupone').value = "0";
          }
          if(something where I identify if it is required and the field is null){return null;}
          else{continue with ajax call;}
  </code></pre>