Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ruskid committed Mar 24, 2015
1 parent 6da89e6 commit 36cc8a6
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions StripeForm.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function init() {
}

//Set default request behavior when no client validation applied
if (!isset($this->stripeRequestHandler) && !$this->applyJqueryPaymentValidation) {
if (!isset($this->stripeRequestHandler)) {
$this->stripeRequestHandler = 'jQuery(function($) {
$("#' . $this->options['id'] . '").submit(function(event) {
var $form = $(this);
Expand Down Expand Up @@ -203,9 +203,8 @@ public function registerJqueryPaymentScripts() {
return this;
};
$("#' . $this->options['id'] . '").submit(function(e) {
e.preventDefault();
var $form = $(this);
$("#' . $this->options['id'] . ' button").on("click", function(e) {
var $form = $("#' . $this->options['id'] . '");
var $number = $("input[data-stripe=' . self::NUMBER_ID . ']");
var $cvc = $("input[data-stripe=' . self::CVC_ID . ']");
var $exp = $("input[data-stripe=' . self::MONTH_YEAR_ID . ']");
Expand All @@ -222,11 +221,9 @@ public function registerJqueryPaymentScripts() {
$("#' . $this->brandContainerId . '").text(cardType);
if($form.find(".' . $this->errorClass . '").length == 0){
$form.find("button").prop("disabled", true);
Stripe.card.createToken($form, stripeResponseHandler);
if($form.find(".' . $this->errorClass . '").length != 0){
e.preventDefault();
}
return false;
});
});';
$view->registerJs($js);
Expand Down

0 comments on commit 36cc8a6

Please sign in to comment.