Replies: 1 comment 2 replies
-
Because with form schemas it is hard to figure out what the rules actually entail. Specifically, cross-field validation is the main reason for this. Let's say you have a password confirmation rule, now this rule forces the validation to run whenever any of the two fields change. Same thing for conditional rules where some field is validated by relation to another, like The problem here is, that we can't make any assumptions about those relations anymore since we now allow 3rd party validations with So yes while this could be a performance concern, I have tested the current implementation with around 300 fields and it seems to perform well. Of course, the number of fields doesn't speak for the performance complexity as you can easily run into performance issues with 3 or 4 levels deep of nested array forms. When fields are specified rules individually, it doesn't make any assumptions about any relationships and thus cross-field validation behavior is dodgy in that case. |
Beta Was this translation helpful? Give feedback.
-
This a variation of this already closed issue
In your response you were right that with posted example, fields are validated independently. But look at my updated example (Vue 3.2.37, Vee-validate 4.6.2) which uses schema validation on form instead of specifying rules on each field.
The email validator is indeed executed every time the name field is changed.
I understand this behavior can have some performance implications for a huge forms but I'm more concerned about usability side of things. Vee-validate behaving like this makes easier implementation of more complicated rules involving multiple fields (for example depending on field A value selected, different condition is applied on field B) or generally the rules that "belong" to the form as a whole and cannot be easily attached to just one single field.
So my concern is why is Vee-validate behaving differently when rules are not specified as part of form schema but as separate rules passed to
useField
instead. Is this intended? If yes, why ?Thanks very much for any comment
Beta Was this translation helpful? Give feedback.
All reactions