Ticket #9688 (closed bug: notabug)

Opened 5 months ago

Last modified 4 months ago

No event when date is changed by restrictMinMax

Reported by: nash Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.10.0
Keywords: Cc:
Blocking: Blocked by:

Description

When integrating with frameworks such as angular.js, one can subscribe to onSelect event. However, if a date was changed by applying new min/maxDate, there's no way to detect this, because onSelect isn't fired.

The main input and altField are updated as expected, although altField is not always an option.

I'm not sure about onSelect, maybe a special event like onChangeDate (to be compared to onChangeMonthYear) is needed.

Here's a simple demo to demonstrate the problem  http://plnkr.co/edit/DhikhK5DiaIswbreBKix

Change History

comment:1 Changed 5 months ago by tj.vantoll

I did some research here to help determine how to handle this.

For the native inputs - date, number, and range at least - when the min is changed, a change event is not fired, and the value itself is not changed -  http://jsfiddle.net/tj_vantoll/wLe4b/.

In jQuery UI we are already inconsistent because spinner triggers a change event and the slider does not -  http://jsfiddle.net/tj_vantoll/zZVfG/.

Of course, a change event is not a select event, but the same idea applies.

I really don't think we should trigger an event here. And to take things a step further, we should probably avoid changing the value when the min/max is changed for consistency with the native controls.

comment:2 Changed 4 months ago by tj.vantoll

  • Status changed from new to closed
  • Resolution set to notabug

We discussed this at our meeting. For consistency with the native control, we should avoid triggering an event, as well as stop changing the <input>'s value. We won't tackle this in the current datepicker, but I made a note for the  rewrite.

Note: See TracTickets for help on using tickets.