Skip to content

Commit

Permalink
Merge pull request #123 from comicrelief/add_validate_changes_v1
Browse files Browse the repository at this point in the history
Add validate changes
  • Loading branch information
deniselashlley authored May 25, 2018
2 parents e97f76c + 37b92e0 commit 1026159
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/InputField/InputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class InputField extends Component {
}

/** Handles the callback isValid state to parent component. */
handleInputChange() {
handleInputChange(e, callback) {
if (typeof this.props.isValid === 'function') {
this.props.isValid(this.state.valid);
this.props.isValid(e, callback);
}
}
render() {
Expand Down Expand Up @@ -81,8 +81,7 @@ class InputField extends Component {
pattern={this.props.pattern && this.props.pattern}
aria-describedby={`field-label--${this.props.id} field-error--${this.props.id}`}
onBlur={this.props.type !== 'checkbox' ? this.validateField : undefined}
onChange={this.props.type !== 'checkbox' ? () => this.handleInputChange() : e => this.onChangeHandler(e)}

onChange={this.props.type !== 'checkbox' ? e => this.handleInputChange(e, this.validateField) : e => this.onChangeHandler(e)}
/>
{this.props.type === 'checkbox' &&
// span for checkbox styling
Expand Down

0 comments on commit 1026159

Please sign in to comment.