Skip to main content

Search and Top Navigation

#6264 closed bug (wontfix)

Opened November 05, 2010 12:34AM UTC

Closed August 09, 2011 12:28PM UTC

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.

Attachments (0)
Change History (11)

Changed May 25, 2011 03:56AM UTC by marcneuwirth comment:1

_comment0: Submitted a pull request \ https://github.com/jquery/jquery-ui/pull/3341306299629420138

Changed June 28, 2011 03:59PM UTC by marcneuwirth comment:2

resolution: → fixed
status: newclosed

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

Changed June 28, 2011 04:00PM UTC by marcneuwirth comment:3

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

Changed June 28, 2011 04:01PM UTC by gnarf comment:4

milestone: TBD1.8.15

Changed August 04, 2011 08:38AM UTC by lars.feyerabend comment:5

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

Changed August 08, 2011 04:20PM UTC by lencioni comment:6

Replying to [comment:5 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.

Changed August 08, 2011 06:28PM UTC by ElectricFront comment:7

Replying to [comment:5 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.

Changed August 09, 2011 12:26PM UTC by Scott González comment:8

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

Changed August 09, 2011 12:27PM UTC by Scott González comment:9

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

Changed August 09, 2011 12:27PM UTC by scottgonzalez comment:10

milestone: 1.8.151.9
resolution: fixed
status: closedreopened

Changed August 09, 2011 12:28PM UTC by scottgonzalez comment:11

resolution: → wontfix
status: reopenedclosed

Closing as wontfix because of the problems mentioned above. We'll make sure events fire correctly in the rewrite.