I am using jQueryUI and datepicker in a rather complicated form. I have a group of 4 datepickers that are all dependent on each other. For example selecting a Date in Datepicker A results in a change of the valid date range of Datepicker B a.s.o.
This is easily achieved by using the onSelect option of the datepicker:
onSelect: function(selectedDate){
//find datepicker B;
//edit the valid date range of datapicker B.
}
Now comes the problematic use case: Since these fields are not required a user is allowed to take the following steps:
1) Selects a date in date picker A. This would trigger the onSelect and restrict the date range of date picker B. 2) Changes his mind and wants to clear the date in date picker A.
Step 2) is problematic: First of all, for some obscure reason, jQueryUI > 1.7 does not have a clear button. So the input field of the datepicker has to be editable to even allow the user to delete (by using the backspace button) his previously selected date. Maybe I can accept that.
But here comes the real problem: After the user has manually deleted his date from the input field, I have no hook for my "reset" logik,a.k.a. removing the restrictions previously applied to date picker B. The onSelect is not triggered, but as far as I can see, nothing else is either.
Is the only way to reset my logic, to put an blur listener on the datepicker input field that everytime checks to see if the value is empty? Is it is so, then I really view the omition of a clear mechanism in the datepicker widget as a major bug. If the widget allows me to restrict the dates of other datepicker widgets, then it should also allow me to lift those restrictions.
DISCLAIMER: This post is partially a duplicate to this question, but the only awnser points to a js "hack" that doesn't correctly work (clear button disappears when changing the month). I also viewed Ticket #3999 from the jQuery issue management. It is closed as "wontfix" :/
Thank you for any help.