File tree 2 files changed +14
-10
lines changed
2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -186,15 +186,7 @@ export const FormField = React.forwardRef(
186
186
handleValidation ( ) ;
187
187
} , [ value ] ) ;
188
188
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 ) ;
198
190
199
191
const wrapperClassNames = classnames (
200
192
styles . wrapper ,
@@ -320,3 +312,15 @@ export const FormField = React.forwardRef(
320
312
}
321
313
} ,
322
314
) ;
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
+ }
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ Use this to allow users to provide long answers.
53
53
## Validation message
54
54
55
55
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.
57
57
58
58
<Playground >
59
59
{ () => {
You can’t perform that action at this time.
0 commit comments