-
Notifications
You must be signed in to change notification settings - Fork 533
Include UID for emitted form validation events #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_uid is not a public property exposed by Vue, we can not rely on it.
src/formGenerator.vue
Outdated
@@ -307,7 +307,7 @@ div.vue-form-generator(v-if='schema != null') | |||
} | |||
|
|||
let isValid = this.errors.length == 0; | |||
this.$emit("validated", isValid, this.errors); | |||
this.$emit("validated", isValid, this.errors, this._uid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you're relying on the internal _uid from the Vue component, this property is undocumented and meant for internal use by Vue. If you'd like to implement something like this, then I'd recommend you introduce a stable property and initialize it with a value we can rely on.
Maybe it would make more sense if we returned the VFG instance in the validated event instead of a UID or tracking number. This would allow developers to have access to the entire VFG instance .... Something like this?
Devs could then use the internal _uid property, or add additional attributes to the VFG tag ... such as |
Sounds like a plan. Done!! |
Added a UID to from validation events to allow tracking validation of forms inside of a vue template loop.