I have form with validation on form submit, using this.$validator.validateAll()) on root component. I set deffered validations so errors not appear immediately - e.g. using v-validate.disable="'required'" on text input.
My question is, how can I apply this deferred validation behaviour on custom components, where I control required validation rule myself (when component is filled and when not). If I use this.errors.add and this.errors.remove API, errors appear in errors object immediately, and I want them to appear after form submit.
It should work the same for custom components if it does not then create an example for it in jsfiddle or codesandbox and I would more than happy to investigate it.
I found well working solution to manually attach and detach to validator providing getter for value:
this.$validator.attach(name: this.name, rules: 'required', getter: () => this.getValue() });
Found mentioning about attach with getter in docs but separate example would be very helpful for new users :)
Most helpful comment
I found well working solution to manually attach and detach to validator providing getter for value:
this.$validator.attach(name: this.name, rules: 'required', getter: () => this.getValue() });Found mentioning about attach with getter in docs but separate example would be very helpful for new users :)