From b9ffa199655add34be814f20e57de6f25d550279 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 8 Mar 2016 15:05:01 -0300 Subject: [PATCH] fix prevent submit --- src/js/controllers/walletHome.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 606702a97..20ef4cfa4 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txService){ +angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txService) { var self = this; window.ignoreMobilePause = false; @@ -351,7 +351,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi $scope.paymentExpired = true; $interval.cancel(countDown); } - $scope.expires --; + $scope.expires--; }, 1000); }; @@ -835,7 +835,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi }, 1); }; -// subscription + // subscription this.setOngoingProcess = function(name) { var self = this; self.blockUx = !!name; @@ -856,6 +856,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi }; this.submitForm = function() { + if (!$scope._amount || !$scope._address || self.destinationWalletNeedsBackup) return; var fc = profileService.focusedClient; var unitToSat = this.unitToSatoshi; var currentSpendUnconfirmed = configWallet.spendUnconfirmed; @@ -870,11 +871,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi } var form = $scope.sendForm; - if (form.$invalid) { - this.error = gettext('Unable to send transaction proposal'); - return; - } - var comment = form.comment.$modelValue; // ToDo: use a credential's (or fc's) function for this @@ -1125,7 +1121,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi setExpiredPaymentValues(); $interval.cancel(countDown); } - self.timeToExpire --; + self.timeToExpire--; }, 1000); function setExpiredPaymentValues() { @@ -1134,7 +1130,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi self._paypro = null; self.error = gettext('Cannot sign: The payment request has expired'); }; - }; + }; this.setFromUri = function(uri) { var self = this;