-
-
Notifications
You must be signed in to change notification settings - Fork 520
Description
Describe the bug
Hi :)
I'm trying to implement a tanstack form in my project, but I've encountered a problem.
Namely, validation errors from the server-side action using the ZOD aren't being sent to the form's inputs. They're visible in state
and the form itself, but they're not visible in field.state.meta.errors
🙆♀️
I followed the official guide and some YouTube tutorials, but there aren't enough examples online for this scenario :/
I'd like to avoid returning my own object from "zodErrors" and parsing it in the client component; I'd like to use the returned function from createServerValidate
.
I validate all the code in onBlur
and onSubmit
using the ZOD scheme => and everything works. ✔️
However, when I do the same in the server action:
const serverValidate = createServerValidate({
onServerValidate: formSchema,
});
the errors don't get sent to the fields. They're visible in state
and form
, but they don't propagate downstream.
Normal behavior
Validation with ZOD, from onBlur
/ onChange
:


Behavior when errors are comming from server action


Your minimal, reproducible example
https://codesandbox.io/p/github/AdamZajler/tanstack-form-nextjs-mui-server-action-zod/main // https://github.com/AdamZajler/tanstack-form-nextjs-mui-server-action-zod
Steps to reproduce
- Run project
- Enter some values, for ex. firstName:
123
and random valid e-mail address - Press enter
- Now you will be seing a VALID response, all errors will be visible under inputs
- Now fill form with firstName with required length, ex.
123456
- Now errors will not be shown under inputs
Expected behavior
Errors from server-side field validation will appear under specific fields in the client component; just like with onBlur
/onChange
validation, because the error format is the same
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- Ubuntu 24
- Chrome
TanStack Form adapter
react-form
TanStack Form version
v1.19.2
TypeScript version
v5.9.2
Additional context
Has anyone encountered this problem? How did the list solve it? Can anyone provide a working example?