Closed Mikilll94 closed 5 years ago
Sorry about the confusion, the fields
do not represent the provider components, as they have their own isolated scope.
You could add a top-level observer and get your field status off that:
<ValidationObserver v-slot="{ dirty }">
<!-- Some Providers -->
</ValidationObserver>
You could also get it manually like this:
<ValidationObserver ref="observer">
<!-- Some Providers -->
</ValidationObserver>
function isFormDirty() {
return this.$refs.observer && this.$refs.observer.ctx.dirty;
}
v3 will have much clearer documentation regarding the validation components.
I am having this issue now and just for others, this.$refs.observer.ctx.
is undefined in version 3.4.14
How to check if form is dirty using ValidationProvider?
In docs it is clearly explained how to achieve that using directive
https://baianat.github.io/vee-validate/guide/flags.html#introduction
Here is the code:
isFormDirty() { return Object.keys(this.fields).some(key => this.fields[key].dirty); }
Unfortunately when using ValidationProvider I noticed that
this.fields
is empty. So to check if form is dirty using ValidationProvider?