TanStackT
TanStack5mo ago
2 replies
slow-yellow

Why can field validation overwrite form validation errors?

Not sure if this is the right place to ask, but I'm going over the docs for Form and came across this in the validation guide:

Something worth mentioning is that if you have a form validation function that returns an error, that error may be overwritten by the field-specific validation.

I was wondering what the rationale is for this behavior/limitation? errorMap already stores errors from different points in the form lifecycle (onBlur/
onChange
etc), why not also store form/field errors separately?

Not that it needs a use case proving its worth, but something simple like this would break, no?

1. validate the entire form with something like Zod
2. use field-specific validation in the email field make sure the email exists
Was this page helpful?