Conditional Validation in Form Schema Using Zod #3421
Closed
BinarySenseiii
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone,
I'm currently working on a validation schema for a form in my project, and I'm looking for some guidance on how to implement conditional validation. Here's a simplified version of what I have
In this schema, I have a method field which can take values 'fixed', 'timed', or 'bids'. What I'm trying to achieve is to make the price field required only when the method is set to 'fixed', otherwise, it should be optional. but rn error isnt triggering
Could someone please guide me on how to add this conditional validation effectively using zod ?
Thanks in advance for your help! 🙏
Beta Was this translation helpful? Give feedback.
All reactions