Validate child components
See original GitHub issueVersions
- vee-validate: 2.2.10
- vue: 2.6.10
Describe the bug
If I add a component to my form, which has an input that should be required
, the validation result is always true.
To reproduce
This is from the parent component:
<component
:name="'field-value'"
v-model="newField.value"
:is="newField.value">
</component>
This is the child component:
<template>
<b-input
:id="'form-'+name"
:name="'form-'+name"
type="number"
v-validate="'required|numeric'"
:state="errors.has('form-modal.form-'+name) ? 'invalid' : ''"
:value="value"
v-on:input="$emit('input',$event)"/>
</template>
<script>
export default {
name: 'Integer',
inject: ['$validator'],
props: ['name', 'value'],
}
</script>
This is the parent validation:
this.$validator.validateAll ('form-modal').then ((result) => {
if (result) {
//do stuff
this.$validator.reset ();
this.$refs.modal.hide ();
}
});
Expected behavior If the field is empty, no error is being shown. All other validations in the modal are working fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Child Component Validation - CodeSandbox
Child Component Validation. Vuelidate child component validation. ... Forked FromCustom Validator; Environmentvue-cli. Files. src. assets. components.
Read more >How to validate input in child component - angular
If you want your components to be "understandable" by a form, they must first implement interface ControlValueAccessor in order to be considered ...
Read more >Custom Validations between Child, Parent ... - Salesforce Bolt
In this blog you will learn how you may use validation between Child, Parent and Grandparent component. The requirement was to have a...
Read more >Angular Reactive Forms in parent-child components
The parent component will have the FormModel with all the validations, either those are built-in, custom, async or dynamic validators.
Read more >Validate a Telerik component as child component and apply ...
Internally, the Telerik Blazor components use the cascading EditContext parameter that the EditForm provides to determine if validation passes or fails. If it ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pwgardipee did you find a solution?
@logaretm How can I use
ValidationProvider
andValidationObserver
to do the validation on a child from the parent? I have recently migrated tov3
.