No way to show FieldArray validation errors for user if FieldArray has no items inside
See original GitHub issueRelease v6.5.0 introduces bugfix:
Do not set FieldArray as touched on submit.
Here is meta
props passed to my component (wrapped with FieldArray
) initially:
{
dirty: false,
error: "Array should not be empty",
invalid: true,
pristine: true,
submitting: undefined,
touched: false,
valid: false,
warning: undefined
}
After user hit “Submit” button, component doesn’t rerenders and those props doesn’t changed.
Now it’s impossible to show error to user if there is no items inside array - previously it was like this:
(!pristine || touched) && invalid && error
.
Now this always false until user did not interact with component wrapped in FieldArray
.
Example of this can be found in redux-form v6.5.0 FieldArray example - just hit “Submit” and you will not see errors regarding to members
.
Possibly related issue: #2207
Is there any way to show errors to user until he interact with this component?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top Results From Across the Web
can't bind Formik Validations Errors for an array of object
I was facing a similar issue but I solved it using getIn . You can use it by following: import { getIn }...
Read more >React FieldArray Form Tutorial: Using Formik, Yup ... - YouTube
In this tutorial, we'll build a donations platform using the Formik FieldArray form with React and Yup for validation.In order to validate ......
Read more ><FieldArray /> | Formik
<FieldArray /> is a component that helps with common array/list manipulations. ... Determines if form validation should or should not be run after...
Read more >FieldArray
Fields representing arrays have an additional layer of complexity, since array items may be reordered, added, or removed as well as updated. <FieldArray>...
Read more >FieldArray - Redux Form
The FieldArray component is how you render an array of fields. ... if the array is invalid, it should return an error (usually,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Removing the
touched
property might solve some bugs, but introduces a new one. As in this example where you’ll never see the"At least one member must be entered"
message.I came here because I had the following problem: I have a radiogroup wrapped in FieldArray where one of the values of the group have to be selected by the user. Since the
touched
property was removed I can’t point to the user that the at least one of those radio buttons must be chosen.My “solution” was to regress to
6.4.3
where this still works, but I hope this might be solved in future releases.This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.