Skip to content

Commit 90ea008

Browse files
author
darryltec
committed
make sean happy
1 parent d701210 commit 90ea008

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

packages/components/src/FormField/FormField.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,7 @@ export const FormField = React.forwardRef(
186186
handleValidation();
187187
}, [value]);
188188

189-
let hasErrors = false;
190-
if (validations) {
191-
hasErrors = validations.some(validation => {
192-
return (
193-
(validation.shouldShow || validation.shouldShow === undefined) &&
194-
validation.status === "error"
195-
);
196-
});
197-
}
189+
const hasErrors = hasErrorMessages(validations);
198190

199191
const wrapperClassNames = classnames(
200192
styles.wrapper,
@@ -320,3 +312,15 @@ export const FormField = React.forwardRef(
320312
}
321313
},
322314
);
315+
316+
function hasErrorMessages(validations?: ValidationProps[]) {
317+
if (validations) {
318+
return validations.some(validation => {
319+
return (
320+
(validation.shouldShow || validation.shouldShow === undefined) &&
321+
validation.status === "error"
322+
);
323+
});
324+
}
325+
return false;
326+
}

packages/components/src/InputText/InputText.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Use this to allow users to provide long answers.
5353
## Validation message
5454

5555
You can add your own custom validation messages on a field. However, this
56-
shouldn't replace of your server-side validation.
56+
shouldn't replace server-side validation.
5757

5858
<Playground>
5959
{() => {

0 commit comments

Comments
 (0)