From 10ca3b6467af2bea723e661160ba5cf2a41ab3b0 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 24 May 2017 10:13:43 -0700 Subject: Fix bug where submit was enabled when invalid params were filled out. --- ui/app/components/bn-as-decimal-input.js | 2 +- ui/app/components/pending-tx.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js index de01f8b5f..1d292ca2a 100644 --- a/ui/app/components/bn-as-decimal-input.js +++ b/ui/app/components/bn-as-decimal-input.js @@ -67,7 +67,7 @@ BnAsDecimalInput.prototype.render = function () { const scaledNumber = this.upsize(value, scale, precision) const precisionBN = new BN(scaledNumber, 10) - onChange(precisionBN) + onChange(precisionBN, event.target.checkValidity()) }, onInvalid: (event) => { const msg = this.constructWarning() diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index eed0fd9ae..8e63f5c76 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -346,18 +346,24 @@ PendingTx.prototype.miniAccountPanelForRecipient = function () { } } -PendingTx.prototype.gasPriceChanged = function (newBN) { +PendingTx.prototype.gasPriceChanged = function (newBN, valid) { log.info(`Gas price changed to: ${newBN.toString(10)}`) const txMeta = this.gatherTxMeta() txMeta.txParams.gasPrice = '0x' + newBN.toString('hex') - this.setState({ txData: clone(txMeta) }) + this.setState({ + txData: clone(txMeta), + valid, + }) } -PendingTx.prototype.gasLimitChanged = function (newBN) { +PendingTx.prototype.gasLimitChanged = function (newBN, valid) { log.info(`Gas limit changed to ${newBN.toString(10)}`) const txMeta = this.gatherTxMeta() txMeta.txParams.gas = '0x' + newBN.toString('hex') - this.setState({ txData: clone(txMeta) }) + this.setState({ + txData: clone(txMeta), + valid, + }) } PendingTx.prototype.resetGasFields = function () { -- cgit v1.2.3