-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Hi, thx for awesome validator.
But im have trouble.. when in try validate multicomponent form, child not validate if this.validate has error below child component
for example
<component>
field=name
field=email
field=avatar
..
<child-component ref="child">
field=isProduct,
field=isDemo,
field=allFiles,
<products-component v-if="isProduct" ref="products">
field=files
<product-add-component>
</products-component>
field=anotherData0
....
field=anotherDataN
<demos-component v-if="isDemo" ref="demos">
field=demos
<demo-add-component>
</demos-component>
</child-component>
field=agree
</component>
in child-component i have validate rules like
'allFiles': function (value) {
return Validator.custom(function () {
if (this.isProduct) {
return this.$refs.products.$validate().then(function(success){
if (!success)
return 'no products';
});
}
}, this)
},
in products component i have validate rules like
'files' : function(value) {
return Validator.value(value).greaterThan(0);
}
so then in main component im use
child = this.$refs.child.$validate();
component = this.$validate();
Promise.all([child, component]).then(function(results){
})
errors from child component show if field=agree is valid
and not show if field=agree invalid
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels