Skip to content
Snippets Groups Projects
Unverified Commit 4d6066b8 authored by Tom Robinson's avatar Tom Robinson
Browse files

FormField proptypes

parent b8bc2e80
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,10 @@ import cx from "classnames";
export default class FormField extends Component {
static propTypes = {
// redux-form compatible:
error: PropTypes.object,
name: PropTypes.string,
error: PropTypes.any,
visited: PropTypes.bool,
active: PropTypes.bool,
displayName: PropTypes.string.isRequired,
......@@ -16,7 +18,7 @@ export default class FormField extends Component {
};
getError() {
if (this.props.error) {
if (this.props.error && this.props.visited !== false && this.props.active !== true) {
return this.props.error;
}
......
......@@ -14,7 +14,7 @@ import { reduxForm } from "redux-form";
validate: (values) => {
const errors = {};
if (!values.name) {
errors.name = true;
errors.name = "Name is required";
}
if (!values.color) {
errors.color = "Color is required";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment