Datepicker: Multiple instances and losing focus

Datepicker: Multiple instances and losing focus


First off, this has been a great control and is really working out
well for us.. I wanted to run this by the mailing list before
submitting a bug -- as I'm sure someone else has run into this in the
past. When we have multiple controls on a form with a datepicker
attached, we are finding that opening a datepicker with one control,
then moving the focus to the second control the calendar does not
close for the original control. This would seem to be as designed,
except the case in which only buttons are being used to activate the
control. As example (from a previously posted link):
http://askthecssguy.com/help/datepicker/arrivalDeparture.html
1. Click on the button for the "Departure Date" to display the
calendar
2. Click on the textbox for the "Arrival Date"
You will find that the original calendar is not closed, and that upon
selecting a date, the date for the bottom textbox is filled-in.
One method of resolving this issue involves modifying the following
code (from ui.datepicker.js):
    _checkExternalClick: function(event) {
        if (!$.datepicker._curInst)
            return;
        var $target = $(event.target);
        if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
                !$target.hasClass($.datepicker.markerClassName) &&
                !$target.hasClass($.datepicker._triggerClass) &&
                $.datepicker._datepickerShowing && !($.datepicker._inDialog &&
$.blockUI))
            $.datepicker._hideDatepicker(null, '');
    },
and removing the clause that checks for the marker class name. This
is a bit more brute-force than was probably intended, though.
I was hoping someone else may have run into the same problem. I would
really appreciate any suggestions/comments regarding this issue.
Thank you,
-bobby