Vee-validate: How to validate when blur a component.

Created on 17 Nov 2017  ยท  1Comment  ยท  Source: logaretm/vee-validate

Hello,

I have add v-validate="'required'" in input tag <input> and <multiselect> and <datepicker>.
https://github.com/monterail/vue-multiselect
https://github.com/charliekassel/vuejs-datepicker

This require validation works well with <input> tag after we blur it without fill data.
But this require validation doesn't work with <multiselect> and <datepicker> after I blur them without choose data.

How can I make it works like <input>?

Thanks.

โ” question

Most helpful comment

unless these component emit the blur event, you cannot validate them on blur. However there are alternative events that might give you the same behavior using data-vv-validate-on attribute to override the default events.

For the multiselect it emits close event when the dropdown is closed which is also when the user leaves the control.

<multiselect data-vv-validate-on="input|close" ...>

For the date-picker you can instead validate on closed since that event emits when the user leaves the control.

<datepicker data-vv-validate-on="input|closed" ...>

>All comments

unless these component emit the blur event, you cannot validate them on blur. However there are alternative events that might give you the same behavior using data-vv-validate-on attribute to override the default events.

For the multiselect it emits close event when the dropdown is closed which is also when the user leaves the control.

<multiselect data-vv-validate-on="input|close" ...>

For the date-picker you can instead validate on closed since that event emits when the user leaves the control.

<datepicker data-vv-validate-on="input|closed" ...>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

HunterJS-bit picture HunterJS-bit  ยท  3Comments

yyyuuu777 picture yyyuuu777  ยท  3Comments

Shchepotin picture Shchepotin  ยท  3Comments

the94air picture the94air  ยท  3Comments

ash0080 picture ash0080  ยท  3Comments