question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't send input event on programmaticly change date

See original GitHub issue

I’m submitting a …

[X] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe
  • flatPickr version : 4.2.4
  • Vue.js version : 2.5.13
  • Browser name and version : Chrome 63.0.3239.132
  • This package version : 6.2.0

Current behavior When updating a date programatically, it sends an input event

Expected behavior It shouldn’t send an input event

Minimal reproduction of the problem with instructions I don’t think it should send back an input event. We already know that…

Here for the setDate, the second parameter should be false https://github.com/ankurk91/vue-flatpickr-component/blob/master/src/component.vue#L132

Imagine I’ve a dropdown to select pre-defined dates, and I’ve a custom entry for custom date. When I listen for input event, I set the dropdown value to custom, and after the datepicker fire an event, which make the dropdown do it’s thing and so on.

I believe that this date change should be done silently.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ankurk91commented, Jan 16, 2019

Your second fiddle is your custom flatpickr component. You are not taking care of two way sync. Your second fiddle does not update the DOM (flatpickr instance), it only update the v-model.

I have already explained why this component always fires change event, see my above comment.

Feel free to fork, copy this component and use in your project.

0reactions
rahulpanteoncommented, Jan 16, 2019
  1. https://jsfiddle.net/xw18myL0/ change event fires when I press Set date programmatically button.
  2. https://jsfiddle.net/qc73xshj/ change event does not fire when press Set date programmatically button.

Change events works when user change date using picker, that is fine.

I would like to have a second option. Is it possible using this pluggin?

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Solution for on change doesn't work when input is ...
The onchange event only fires if the user changes the value of the input. It isn't supposed to fire if the input is...
Read more >
HTMLElement: change event - Web APIs | MDN
When the user commits the change explicitly (e.g., by selecting a value from a <select> 's dropdown with a mouse click, by selecting...
Read more >
lightning-record-edit-form - Salesforce Developers
If you capture the submit event and submit the form programmatically, use event.preventDefault() to cancel the default behavior of the event. This prevents...
Read more >
SCR19: Using an onchange event on a select element ... - W3C
The objective of this technique is to demonstrate how to correctly use an onchange event with a select element to update other elements...
Read more >
Form <input> elements must have labels | Axe Rules
Sign up for the axe newsletter. Stay up to date on axe features, updates, and events. ... Programmatically associate labels with all form...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found