zaguiini / formik-wizard

A multi-step form component powered by formik and react-albus
MIT License
86 stars 26 forks source link

How to change validationSchema conditionally #28

Closed Bulletninja closed 4 years ago

Bulletninja commented 4 years ago

I've been able to use formik-wizard to build that, a wizard with validation succesfully, but i want my form to have some fields that are depended on others. For example, if you say "no" you might not need to answer more questions, but if you say "yes" you need to fill some more fields. How can i update my validationSchema to ignore those hidden/non-rendered fields?

Bulletninja commented 4 years ago

Nevermind, noticed this is more about the way i'm using yup, and not formik-wizard

zaguiini commented 4 years ago

Exactly, this is bound to yup and conditionals. check yup.test({ when: boolean }) for more information.