Opened 13 years ago
Closed 12 years ago
#6264 closed bug (wontfix)
Datepicker's onSelect not fired when setDate() is called.
Reported by: | jcm | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.datepicker | Version: | 1.8.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When calling setDate I would expect the onSelect event to be called. It is very common for users to put additional formatting information in the onSelect function. As such, it seems reasonable to expect onSelect to fire when the date is changed.
I would actually consider this a major bug but I will keep it as minor for someone more qualified to change if they deem necessary.
Change History (11)
comment:2 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Datepicker: Added onSelect.apply() call to _setDate method if onSelect is defined. Fixed #6264 - Datepicker: onSelect does not fire when setDate is called
Changeset: effdd5d19c534f8445ebafe4212278c4366b0041
comment:3 Changed 12 years ago by
Datepicker: Added onSelect.apply() call to _setDate method if onSelect is defined. Fixed #6264 - Datepicker: onSelect does not fire when setDate is called (cherry picked from commit effdd5d19c534f8445ebafe4212278c4366b0041)
Changeset: b8e14e79e5bc630bf459137896c08fc37936f52f
comment:4 Changed 12 years ago by
Milestone: | TBD → 1.8.15 |
---|
comment:5 follow-ups: 6 7 Changed 12 years ago by
This fix introduces a serious side effect. People who rely on onSelect to trigger a form submission to the same page will find their page reloading infinitely. For a testcase see here: http://lars-feyerabend.de/datepicker.html
I'm not really sure who is at fault here (me for using this code; you guys for introducing this side effect), but at least it breaks backwards compatibility between versions and as such shouldn't have been included in a minor release. Also, no mention of the changed behaviour of onSelect on http://jqueryui.com/docs/Upgrade_Guide/1.8.14
comment:6 Changed 12 years ago by
Replying to lars.feyerabend:
This fix introduces a serious side effect. People who rely on onSelect to trigger a form submission to the same page will find their page reloading infinitely. For a testcase see here: http://lars-feyerabend.de/datepicker.html
I ran into a similar issue where I was using a datepicker as a navigational tool for a calendar application. I had set it up to redirect the user when a date was selected. Updating from to 1.8.15 caused an infinite redirect loop, just like your example.
Thankfully, binding the redirect function to the change event works as expected. Perhaps that would also work for your form example?
This should certainly be noted in the upgrade guide.
comment:7 Changed 12 years ago by
Replying to lars.feyerabend:
This fix introduces a serious side effect. People who rely on onSelect to trigger a form submission to the same page will find their page reloading infinitely. For a testcase see here: http://lars-feyerabend.de/datepicker.html
I'm not really sure who is at fault here (me for using this code; you guys for introducing this side effect), but at least it breaks backwards compatibility between versions and as such shouldn't have been included in a minor release. Also, no mention of the changed behaviour of onSelect on http://jqueryui.com/docs/Upgrade_Guide/1.8.14
I agree, this breaks some functionality where 2 dates exist but are bounded relative to each other. When updating one of them it causes the other to be updated. This in turn causes a back and forth recursion that eventually is halted by the browser, otherwise it would be infinite. This hasn't been a problem for many 1.8.X versions so the fix doesn't seem to provide a way around this recursion. I contend this may have produced a more severe bug.
comment:8 Changed 12 years ago by
Revert "Datepicker: Added onSelect.apply() call to _setDate method if onSelect is defined. Fixed #6264 - Datepicker: onSelect does not fire when setDate is called"
This reverts commit effdd5d19c534f8445ebafe4212278c4366b0041.
Changeset: e827a0e280c5652a3f49cea9abf35ccbb9939bda
comment:9 Changed 12 years ago by
Revert "Datepicker: Added onSelect.apply() call to _setDate method if onSelect is defined. Fixed #6264 - Datepicker: onSelect does not fire when setDate is called"
This reverts commit b8e14e79e5bc630bf459137896c08fc37936f52f.
Changeset: 3e98e737725ef247b765406330dfadf9e28ee049
comment:10 Changed 12 years ago by
Milestone: | 1.8.15 → 1.9 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
comment:11 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Closing as wontfix because of the problems mentioned above. We'll make sure events fire correctly in the rewrite.
Submitted a pull request https://github.com/jquery/jquery-ui/pull/335