diff --git a/src/components/UtilityAccount/index.js b/src/components/UtilityAccount/index.js index dac0340b0fb5a196abd74c0cf7edbd3db90c6b2d..9d052709828bb1fa941acf554168418226c70837 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 (