Is possible to change Yup validation schema on runtime? #4533
-
Hi, I am using dynamically generated Yup validation schema because of various number of input fields. In the form I am deleting some of these fields and I need to refect this in my form instance How can I do this? Is possible to recreate the form instance without the destruction of my component. Thank you.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
You can just pass a reactive/computed variable as your validation:
|
Beta Was this translation helpful? Give feedback.
-
That is what I thought first, but there is a problem with a form error in some field and a schema change at the same time. I have a problem with the field that I removed from the schema.
|
Beta Was this translation helpful? Give feedback.
-
Its weird but I have to pass computed properties without So correct code is:
|
Beta Was this translation helpful? Give feedback.
Its weird but I have to pass computed properties without
.value
part intouseForm()
Now everything works like a sharm.
So correct code is: