From 249e3ef66ffd9e10d34b0ab5b4f3efaec6fd507a Mon Sep 17 00:00:00 2001
From: "Christophe.Boulain" <>
Date: Thu, 4 Feb 2010 08:08:26 +0000
Subject: Fixed TActiveDatePicker bug
---
HISTORY | 1 +
.../source/prado/activecontrols/activedatepicker.js | 15 +++++++++------
.../active-controls/protected/pages/ActiveDatePicker.page | 11 +++++++----
.../active-controls/protected/pages/ActiveDatePicker.php | 6 +++++-
.../active-controls/tests/ActiveDatePickerTestCase.php | 10 ++++++++++
5 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/HISTORY b/HISTORY
index be9ab783..cfe49b9c 100644
--- a/HISTORY
+++ b/HISTORY
@@ -19,6 +19,7 @@ BUG: Issue#208 - TDbConnection.Charset not working properly (googlenew at pcforu
BUG: Issue#212 - Mistaken query executed by TMysqlMetaData (pbenny, Christophe)
BUG: Issue#216 - TTabPanel doesn't preserve active tab on callback request (googlenew at pcforum.hu,Christophe)
BUG: Typo in TBoundColumn (Robin)
+BUG: TActiveDatePicker js error when date format does not have the 3 elements (Christophe)
ENH: Add property ClientScriptManagerClass to TPageService and releated changes in TPage.getClientScript() (Yves)
ENH: Always render clientside counterparts of validation control even if not enabled, but pass-through Enabled property, to allow Enabled/Disable of validator on callback. (Yves)
EHN: Add property TValidationSummary.ScrollToSummary to server-side control since property exists on client-side. (Yves)
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
index 3aacda21..e96b63ec 100755
--- a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
@@ -46,9 +46,9 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker,
var day = Prado.WebUI.TDatePicker.getDayListControl(this.control);
var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control);
var year = Prado.WebUI.TDatePicker.getYearListControl(this.control);
- Event.observe (day, "change", this.onDateChanged.bindEvent(this));
- Event.observe (month, "change", this.onDateChanged.bindEvent(this));
- Event.observe (year, "change", this.onDateChanged.bindEvent(this));
+ if (day) Event.observe (day, "change", this.onDateChanged.bindEvent(this));
+ if (month) Event.observe (month, "change", this.onDateChanged.bindEvent(this));
+ if (year) Event.observe (year, "change", this.onDateChanged.bindEvent(this));
}
@@ -66,9 +66,12 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker,
}
else
{
- var day = Prado.WebUI.TDatePicker.getDayListControl(this.control).selectedIndex+1;
- var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control).selectedIndex;
- var year = Prado.WebUI.TDatePicker.getYearListControl(this.control).value;
+ var day = Prado.WebUI.TDatePicker.getDayListControl(this.control);
+ if (day) day=day.selectedIndex+1;
+ var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control);
+ if (month) month=month.selectedIndex;
+ var year = Prado.WebUI.TDatePicker.getYearListControl(this.control);
+ if (year) year=year.value;
date=new Date(year, month, day, 0,0,0).SimpleFormat(this.Format, this);
}
if (typeof(this.options.OnDateChanged) == "function") this.options.OnDateChanged(this, date);
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page
index 64f37867..88117744 100755
--- a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page
@@ -1,10 +1,10 @@
-
+
Partial Calendar
+
+
-