-
Notifications
You must be signed in to change notification settings - Fork 102
Add blur event for validation libraries #102
Comments
I know about the I am happy to add import VeeValidate from 'vee-validate';
Vue.use(VeeValidate,{
events:'input|blur|on-close'
}); The <flatpickr name="date" v-validate="'required'" data-vv-validate-on="input|on-close"> |
Ah fair enough, haven't run into any issues with it as of yet but equally haven't made a lot of use of it. The on-close event would work to a point, but we also allow users to manually enter the dates rather than just using the date picker, so in this scenario the |
Ah, i did not notice that you have written |
ah that would be amazing, thank you so much :) |
@pareeohnos |
awesome thank you!! |
Just tried this out and it doesn't seem to work. I think what's happening is the input that the blur event is bound to is changed by flatpickr to the hidden input and thus never actually gets a blur event. |
Oh no, the hidden input is nightmare. |
awesome thanks, sorry it took so long to report back |
Please update to v7.0.6 and let me know it it works for you. |
Sorry for the delay, just got round to testing and it works perfectly. Thanks for the quick turn around |
I'm submitting a ... (check one with "x")
A PR (#22) was opened a while back adding the
blur
event, and you said you couldn't see a use case and that it would mean other events would need adding. In our application, there is a use case for this, and that is when using thevuelidate
where validations can be triggered when a field is blurred. Currently I cannot apply this with vue-flatpickr due to this event not being registered/emit.I don't disagree with your statement that it may make sense then to allow other events to be added such as keyboard events, however since Vue 2.4 it is possible to simply bind all listeners provided to a component via the
$listeners
property.This would allow the developer to decide which listener they wish to bind rather than vue-flatpickr having to pick and choose. I don't know the all of the code, but at a quick glance it would as simple as changing the template of the component to
and adding a computed property
With this change, I would be able to do something like
The text was updated successfully, but these errors were encountered: