I\'m currently trying to create a Registration form with multiple \"Input Field\" components which all require validating once Submit has been pressed. They all currently va
I have a similar setup, I tried the bus solution with the events, didn't get it working. I however used the Provider/Injector pattern as defined in the specs of v-validate.
So in the top most parent, add this line of code (mind it is TYPESCRIPT !)
@Provide('validator') $validator = this.$validator;
And in every child/grandchilds add this line of code:
@Inject('validator') $validator: any;
Now you can do this in your parent, and I will gather all errors from all components with the validator injector. (see specs: https://baianat.github.io/vee-validate/api/errorbag.html#api)
if (this.$validator.errors.any()) {
// Prevent the form from submitting
e.preventDefault();
}
I have a sort-a-like answer in post; vee-validate error object - _vm.errors is undefined
grtz