-
Notifications
You must be signed in to change notification settings - Fork 533
How to use validation results? #45
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
Comments
Yes, the Example: https://github.com/icebob/vue-form-generator/blob/master/dev/app.vue#L76 In template set a ref: vue-form-generator(:schema='schema', :model='model', v-ref:form) In script: let validationErrors = this.$refs.form.errors; |
Again, Wonderful! And Thank You! |
Well... almost... I get fragmented instance errors when using <template>
<div>
<modal title="Modal title">
<vue-form-generator :schema="schema" :model="model" :options="formOptions" v-ref="form"></vue-form-generator>
<div slot="footer">
<button class="btn btn-default" @click="toggleModal">Cancel</button>
<button class="btn btn-success" @click="sendModel">Create</button>
</div>
<modal>
</div>
</template> |
Could you show the error message? Otherwise, the v-ref syntax is |
Standard vue fragmented instance error for the v-ref, with the link to the On Tue, 23 Aug 2016, 21:38 Icebob, [email protected] wrote:
|
vue.common.js?4a36:1019 [Vue warn]: Attribute "v-ref" is ignored on component because the component is a fragment instance: http://vuejs.org/guide/components.html#Fragment-Instance |
I think because your are using in modal so when the modal is not visible, the ref not exists too. |
Your theory is certainly possible, but I cannot confirm it, as I had to find a solution fast, and moved to an SPA architecture in favour of throwing modal boxes. |
I found a solution, here is my PR #52. |
Hi!
Is there a way to access the validation results?
The intention is to enable the disabled submit button once all validation requirements are met.
I know that there's the
onValidated
method for every field, but I can't access anything other than themodel
, theerrors
and thefield
itself and nothing from the parent component.Is there a way to do this without hacking on the model?
And on that note... How to trigger the form validation?
The text was updated successfully, but these errors were encountered: