Sha256: cb0f9f5b86eadf0c42d491486890dc22e0a015e19ee77146237437749d6cd93f
Contents?: true
Size: 634 Bytes
Versions: 53
Compression:
Stored size: 634 Bytes
Contents
/** * Base class providing helper method for deciding if an input contains errors. * Expects subclasses to have `name` and `errors` props. **/ class BaseInput extends React.Component { /** * Checks if the component has associated errors or not **/ hasError() { if (!(this.props && this.props.name)) { return false; } var fieldName = this.props.name.substring(this.props.name.lastIndexOf("[") + 1, this.props.name.lastIndexOf("]")); return (fieldName && this.props.errors && this.props.errors.errors && this.props.errors.errors.indexOf(fieldName) > -1); } }
Version data entries
53 entries across 53 versions & 1 rubygems