Fixed #4448: the calendar widget now refreshes if the date field is changed. THanks, gkelly.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6214 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2007-09-14 21:04:45 +00:00
parent 9cccf59db5
commit 66e4541101
1 changed files with 13 additions and 0 deletions

View File

@ -195,6 +195,19 @@ var DateTimeShortcuts = {
openCalendar: function(num) { openCalendar: function(num) {
var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1+num) var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1+num)
var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName+num) var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName+num)
var inp = DateTimeShortcuts.calendarInputs[num];
// Determine if the current value in the input has a valid date.
// If so, draw the calendar with that date's year and month.
if (inp.value) {
var date_parts = inp.value.split('-');
var year = date_parts[0];
var month = parseFloat(date_parts[1]);
if (year.match(/\d\d\d\d/) && month >= 1 && month <= 12) {
DateTimeShortcuts.calendars[num].drawDate(month, year);
}
}
// Recalculate the clockbox position // Recalculate the clockbox position
// is it left-to-right or right-to-left layout ? // is it left-to-right or right-to-left layout ?