Closed rboddy closed 1 month ago
You can apply that message to a specific field which will then show the message.
Ah, using
Yes, usually what I'll do is just put the error on one of the fields, whichever one is most relevant, in this case probably the end field using a custom error path, described here: https://zod.dev/?id=customize-error-path
Gotcha, thanks for the explanation, I'll go ahead and close this
Describe the bug
If you use refinement to send back a message it doesn't throw, it returns a falsy value as documented here.
Expected Behavior: the message from a refinement is displayed as some kind of message on the frontend, possibly an error
Actual Behavior: My form fields just reset if the refinement requirements are not met, and no message is thrown
I can get around this by creating some kind of custom message on the frontend that is triggered, but I'd prefer the validation takes care of it. I wasn't sure if this was a bug or a feature request, but I thought it'd be more helpful to write it up like a bug.
Reproduction
Sample Schema Code:
Logs
No response
System Info
Severity
annoyance