title: Creating stripe payment token after validating other fields
body: <p>To keep this simple I have only included one of the forms I am validating. Everything validates right, but I can't figure out why a token does not get generated. The form never submits. I had the form working right without validating not sure what the problem is.</p>
  
  <pre><code>var oeValidate = {
      'name' : function() {
          var ele = $('#name');
  
          if(ele.val().length &lt; 6) {
              oeValidate.errors = true;
              ele.removeClass('correct').addClass('error');
          } else {
              ele.removeClass('error').addClass('correct');
          }
      },
  
      'sendIt' : function() {
          if(!oeValidate.errors) {
              $('#payment-form').submit(function(event){
                  // disable the submit button to prevent repeated clicks
                  $('#stripe-submit').attr("disabled", "disabled");
  
                  // send the card details to Stripe
                  Stripe.createToken({
                      name: $('#name').val(),
                      number: $('#card-number').val(),
                      exp_month: $('select[name="card-month"]').val(),
                      exp_year: $('select[name="card-year"]').val(),
                      cvc: $('#card-cvc').val()
                  }, stripeResponseHandler);
  
                  // prevent the form from submitting the default action
                  return false;
              });
          }
      }
  };
  
  Stripe.setPublishableKey(stripe_vars.publishable_key);
  
  function stripeResponseHandler(status, response) {
      if (response.error) {
          // show errors returned by Stripe
          jQuery(".payment-errors").html(response.error.message);
          // re-enable the submit button
          jQuery('#stripe-submit').attr("disabled", false);
      } else {
          var form$ = jQuery("#payment-form");
          // token contains id, last4, and card type
          var token = response['id'];
          // insert the token into the form so it gets submitted to the server
          form$.append("&lt;input type='hidden' name='stripeToken' value='" + token + "'/&gt;");
          // and submit
          form$.get(0).submit();
      }
  }
  
  jQuery(document).ready(function($) {
      $('#stripe-submit').click(function (){
          oeValidate.errors = false;
          oeValidate.name();
          oeValidate.sendIt();
          return false;
      });
  });
  </code></pre>