Skip to content

Commit 758238a

Browse files
authored
Merge pull request #80 from kmarple1/master
Allow setting error externally.
2 parents 43b5cb6 + 65724f5 commit 758238a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/SelectValidator.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default class SelectValidator extends ValidatorComponent {
99
render() {
1010
/* eslint-disable no-unused-vars */
1111
const {
12+
error,
1213
errorMessages,
1314
validators,
1415
requiredError,
@@ -22,7 +23,7 @@ export default class SelectValidator extends ValidatorComponent {
2223
<TextField
2324
{...rest}
2425
select
25-
error={!isValid}
26+
error={!isValid || error}
2627
helperText={(!isValid && this.getErrorMessage()) || helperText}
2728
/>
2829
);

src/TextValidator.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default class TextValidator extends ValidatorComponent {
99
render() {
1010
/* eslint-disable no-unused-vars */
1111
const {
12+
error,
1213
errorMessages,
1314
validators,
1415
requiredError,
@@ -21,7 +22,7 @@ export default class TextValidator extends ValidatorComponent {
2122
return (
2223
<TextField
2324
{...rest}
24-
error={!isValid}
25+
error={!isValid || error}
2526
helperText={(!isValid && this.getErrorMessage()) || helperText}
2627
/>
2728
);

0 commit comments

Comments
 (0)