Get values in validationSchema for dynamic validation rules
See original GitHub issueAs well as accessing the props in validationSchema
is it possible to get the current values? I’m wanting a way to define the validation dynamically based on the values selected by the user.
e.g.
validationSchema?: Schema | ((props: Props) => Schema)
// becomes
validationSchema?: Schema | ((values: Values, props: Props) => Schema)
happy to submit a PR if you’re interested in this.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:5
Top Results From Across the Web
How to Create an Optional Dynamic Validation Schema based ...
We'll be talking about run-time schema validation. Essentially this lets you define validation rules on the fly when you are attempting to validate...
Read more >Dynamic validation with Yup and Formik using React hooks
In this lesson, I will show u how to deal with dynamic validation based on the article: How-to-Create-an-Optional-Dynamic-Validation-Schema- ...
Read more >Create an Optional Dynamic Validation Schema ... - Egghead.io
In this lesson we'll show how to setup a nested validation structure using the yup library. We'll then use the yup.lazy method to...
Read more >Yup / Formik validation using dynamic keys - Stack Overflow
I want to loop through my object and pass a dynamic set of keys to the schema - basically however long the object...
Read more >Create an Optional Dynamic Validation Schema ... - YouTube
We'll then use the yup.lazy method to evaluate the value at runtime and adjust our validation schema. We'll make our nested validation ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes it is thanks!
so if anyone is interested it’s now
whereas before it was
Hi Dave
Is yup.lazy enough to solve your problem? https://github.com/jquense/yup/blob/master/README.md#yuplazyvalue-any--schema-lazy On Wed, 30 Aug 2017 at 00:23 Dave Timmins notifications@github.com wrote: