vue-datetime icon indicating copy to clipboard operation
vue-datetime copied to clipboard

Initial input event firing with vee-validate

Open kenazs opened this issue 5 years ago • 3 comments

Versions

  • vue: 2.6.10
  • vue-datetime: 1.0.0-beta.10
  • luxon: 1.16.0

Description:

Why is an input event fired with initial values? This interferes with vee-validation that works on input event.

Steps To Reproduce:

template: <datetime v-model="model.test1" @input="debug('test1')" /> <input v-model="model.test2" @input="debug('test2')" />

method: debug(event) { console.log(event); }

"test1" displayed in console and "test2" didn't

kenazs avatar Oct 01 '19 05:10 kenazs

It is fired on created hook to format the initial value. For vee-validate 2.x you can disable auto validation with data-vv-validate-on="none" and run it on close event.

mariomka avatar Nov 13 '19 09:11 mariomka

@mariomka how to prevent the initial input event ? I have an auto save feature on a form, and every time the form is shown, it triggers my API calls

mydnic avatar Mar 04 '20 09:03 mydnic

Firing an initial input event is a little incorrect, don't you think @mariomka? Like... input is meant for when data is entered and most libraries use it at such. So when this library fires an initial input event, that leads to issues. What if there is no initial value?

dargmuesli avatar Sep 04 '20 20:09 dargmuesli