-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field Array validation not working as expected #3
Comments
@erikras Still not working correctly in 1.0.1 Steps to reproduce What happens Expected |
Yep, that's a bug. Thanks! |
Formik's FieldArray has the same issue right now (and touched issues). Array validation seems to be a tricky thing. Redux-Form is the only react form tool that handles these gracefully. This is my last issue with creating all the forms for my company's site. |
Fix published in |
Hmm.. Seems to not be fixed in your sandbox... Reopening.... |
Something went wrong in the publishing of One thing, if your array is full of objects, you need to push an object. push('customers', undefined) // ❌
push('customers', {}) // ✅ |
My meta.error is still undefined for any Field in the field array, even though the form errors are working correctly. FieldArray errors and meta.touched are showing and hiding correctly. My validate function:
|
Show updated sandbox? |
OK. Working on it now. |
I'm not seeing the I did find another bug from this sandbox, though, so thanks for that. |
@erikras it's in the console. |
Duh. 🙄🤦♂️ Okay, escalating this issue back to "bug" status. |
Published fix in |
Verified. Thank you for all your help! |
And thank you for kicking the tires! 👍 |
One thing to note, is if the array is full of empty objects, you need to return undefined in the validate to mark the form as valid. My validate function now looks like this:
|
Yea I have the same concern as above, |
Yeah, I tried to return undefined for each item, then realized the errors weren't mapping anymore. Mine isn't that bad. I mean the only thing I think that @erikras could do is use the same some function on his end to check if all items are empty then return undefined if they are. This would allow us to go back to returning just the array. I would try to do a pull request but I've never done one and not sure what I'm doing. |
@erikras
As you can see the validation is returning correctly, but the form errors are not showing for the field array.
Try typing in a first name.
Also try adding 6 customers, each with just a last name. You only get 3 form errors
The text was updated successfully, but these errors were encountered: