Vee-validate: Retrieve flags outside of template context

Created on 19 Sep 2019  Â·  3Comments  Â·  Source: logaretm/vee-validate

Version

  • vee-validate: 3.0.5

Is your feature request related to a problem? Please describe.
Is there any way in v3 of vee-validate to get the flags of fields outside of a template? I would like to read the state of a field (touched, dirty etc) in code, not in the template. To me it looks like there is no way to do this in the new version?

Describe the solution you'd like
One solution could be to have the observer or provider emit events when flags change.

✨ enhancement

Most helpful comment

The programmatic API still needs some work to be useful like mentioned here #2248 #2283

as a workaround, you could use ref and access them on your own.

for both providers and observers:

this.$refs.provider.flags // contains flags.
this.$refs.observer.flags // contains flags.

All 3 comments

The programmatic API still needs some work to be useful like mentioned here #2248 #2283

as a workaround, you could use ref and access them on your own.

for both providers and observers:

this.$refs.provider.flags // contains flags.
this.$refs.observer.flags // contains flags.

This is very handy, I used this.$refs.observer.ctx.changed to check if a form has changed, and if not, to not send an API request.

Closing since a workaround exists and the alternative is not worth implementing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MeltedFreddo picture MeltedFreddo  Â·  3Comments

the94air picture the94air  Â·  3Comments

schel4ok picture schel4ok  Â·  3Comments

saintplay picture saintplay  Â·  3Comments

MaxMilton picture MaxMilton  Â·  3Comments