summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/Util/TSimpleDateFormatter.php5
-rw-r--r--framework/Web/Javascripts/js/validator.js6
-rw-r--r--framework/Web/Javascripts/prado/validation3.js12
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php4
-rw-r--r--framework/Web/UI/WebControls/TDataTypeValidator.php3
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php3
6 files changed, 29 insertions, 4 deletions
diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php
index 971225b5..03ae7b7d 100644
--- a/framework/Util/TSimpleDateFormatter.php
+++ b/framework/Util/TSimpleDateFormatter.php
@@ -185,7 +185,10 @@ class TSimpleDateFormatter
*/
public function isValidDate($value)
{
- return !is_null($this->parse($value, false));
+ if(is_null($value))
+ return false;
+ else
+ return !is_null($this->parse($value, false));
}
/**
diff --git a/framework/Web/Javascripts/js/validator.js b/framework/Web/Javascripts/js/validator.js
index ee578ea2..0e39d191 100644
--- a/framework/Web/Javascripts/js/validator.js
+++ b/framework/Web/Javascripts/js/validator.js
@@ -125,7 +125,11 @@ return value;},getValidationValue:function(control)
control=this.control
switch(this.options.ControlType)
{case'TDatePicker':if(control.type=="text")
-return this.trim($F(control));else
+{value=this.trim($F(control));if(this.options.DateFormat)
+{date=value.toDate(this.options.DateFormat);return date==null?'':date;}
+else
+return value;}
+else
{this.observeDatePickerChanges();return Prado.WebUI.TDatePicker.getDropDownDate(control).getTime();}
case'THtmlArea':if(typeof tinyMCE!="undefined")
tinyMCE.triggerSave();return this.trim($F(control));case'TRadioButton':if(this.options.GroupName)
diff --git a/framework/Web/Javascripts/prado/validation3.js b/framework/Web/Javascripts/prado/validation3.js
index f5f058c8..b1b20722 100644
--- a/framework/Web/Javascripts/prado/validation3.js
+++ b/framework/Web/Javascripts/prado/validation3.js
@@ -767,7 +767,17 @@ Prado.WebUI.TBaseValidator.prototype =
{
case 'TDatePicker':
if(control.type == "text")
- return this.trim($F(control));
+ {
+ value = this.trim($F(control));
+
+ if(this.options.DateFormat)
+ {
+ date = value.toDate(this.options.DateFormat);
+ return date == null ? '' : date;
+ }
+ else
+ return value;
+ }
else
{
this.observeDatePickerChanges();
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index b2405996..bcddfa5f 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -165,6 +165,10 @@ abstract class TBaseValidator extends TLabel implements IValidator
$options['ControlCssClass'] = $this->getControlCssClass();
$options['ControlType'] = $this->getClientControlClass($control);
+
+ //get date format from date picker target control
+ if($control instanceof TDatePicker)
+ $options['DateFormat'] = $control->getDateFormat();
if(!is_null($this->_clientScript))
$options = array_merge($options,$this->_clientScript->getOptions());
diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php
index bd7569fc..3e91ec15 100644
--- a/framework/Web/UI/WebControls/TDataTypeValidator.php
+++ b/framework/Web/UI/WebControls/TDataTypeValidator.php
@@ -89,6 +89,9 @@ class TDataTypeValidator extends TBaseValidator
*/
protected function evaluateDataTypeCheck($value)
{
+ if($value=='')
+ return true;
+
switch($this->getDataType())
{
case 'Integer':
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 6852f9eb..642d9953 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -296,7 +296,8 @@ class TDatePicker extends TTextBox
{
if($this->getText() === '')
return '';
- return $this->getTimeStamp();
+ $date = $this->getTimeStamp();
+ return $date == null ? '' : $date;
}
/**