From f540015f666bddf739bff4f5255dffbc1b9a5fd6 Mon Sep 17 00:00:00 2001 From: Adarsh Murthy Date: Mon, 27 Feb 2017 09:52:44 -0500 Subject: [PATCH] Checks the length of the utility account number entered --- src/components/UtilityAccount/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/UtilityAccount/index.js b/src/components/UtilityAccount/index.js index dac0340b..9d052709 100644 --- a/src/components/UtilityAccount/index.js +++ b/src/components/UtilityAccount/index.js @@ -52,12 +52,18 @@ class UtilityAccount extends Component { this.props.deleteAccount(this); } + isAccountNumberLong = () => this.state.form.account_number.length > 15; + + showAccountWarning = () => (this.isAccountNumberLong() ? +
Account number is too long
:
); + renderAddAccountBtn = () => { let isDisabled = !(this.state.form.account_number); if (this.state.form.utility === 'national_grid_gas') { isDisabled = !(this.state.form.account_number && this.state.form.access_code) && !(this.state.form.account_number && this.state.form.username && this.state.form.password); } + isDisabled = isDisabled || this.isAccountNumberLong(); return (
-- GitLab