title: Braintree on validation error
body: <p>I'm using Drop-in UI which is configured in Braintree control panel to automatically verificate if the payment method is legit.</p>
  
  <p>So in my application I disable form submit button when it is clicked, and if user payment method is not legit, it says that there is error and doesn't submits form. My question is how to catch this error so I can enable submit button back.</p>
  
  <p>onError event is thrown only if there are not present all fields in input fields. So what about verification error, how do I catch it?</p>
  
  <p>Right now my javascript looks like this:</p>
  
  <pre><code>braintree.setup("#{@braintree_token}", 'dropin', {
    container: 'dropin',
      onReady: function () {
      },
      onError: function() {
        console.log("error");
        $('#submit-payment').removeClass('disabled');
      }
    });
  $("form").submit(function (e) {
    $('#submit-payment').addClass('disabled');
    setTimeout(function() { $('#submit-payment').removeClass('disabled'); }, 2000);
    return;
  });
  </code></pre>
  
  <p>My solution is not ideal right now as it just disables button for 2 seconds. So please suggest me something. </p>
  
  <p>P.S. To be clear I want to catch with Javascript this kind of error:
  <a href="https://i.stack.imgur.com/5i92G.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5i92G.png" alt="enter image description here"></a></p>
  
  <p>P.S.S. Also I have found out that it callbacks this info:</p>
  
  <pre><code>/**/callback_jsond435f0d591e44176bf94ec137859dd3c({"error":{"message":"Credit card verification failed"},"fieldErrors":[{"field":"creditCard","fieldErrors":[{"field":"cvv","code":"81736","message":"CVV verification failed"}]}],"status":422})
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/TgwkR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TgwkR.png" alt="enter image description here"></a></p>