diff options
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/Javascripts/js/compressed/validator.js | 4 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/debug/validator.js | 22 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/validation3.js | 22 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TDataTypeValidator.php | 2 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TDatePicker.php | 6 |
5 files changed, 28 insertions, 28 deletions
diff --git a/framework/Web/Javascripts/js/compressed/validator.js b/framework/Web/Javascripts/js/compressed/validator.js index cecc6881..d3d8c53e 100644 --- a/framework/Web/Javascripts/js/compressed/validator.js +++ b/framework/Web/Javascripts/js/compressed/validator.js @@ -127,7 +127,7 @@ control=this.control switch(this.options.ControlType) {case'TDatePicker':if(control.type=="text") {value=this.trim($F(control));if(this.options.DateFormat) -{date=value.toDate(this.options.DateFormat);return date==null?'':date;} +{date=value.toDate(this.options.DateFormat);return date==null?value:date;} else return value;} else @@ -201,5 +201,5 @@ return false;required.each(function(requiredValue) var min=typeof(this.options.Min)=="undefined"?Number.NEGATIVE_INFINITY:this.options.Min;var max=typeof(this.options.Max)=="undefined"?Number.POSITIVE_INFINITY:this.options.Max;return exists&&checked>=min&&checked<=max;},getRequiredValues:function() {var required=[];if(this.options.Required&&this.options.Required.length>0) required=this.options.Required.split(/,\s*/);return required;}});Prado.WebUI.TDataTypeValidator=Class.extend(Prado.WebUI.TBaseValidator,{evaluateIsValid:function() -{var value=this.getValidationValue();if(value.length<=0) +{value=this.getValidationValue();if(value.length<=0) return true;return this.convert(this.options.DataType,value)!=null;}});
\ No newline at end of file diff --git a/framework/Web/Javascripts/js/debug/validator.js b/framework/Web/Javascripts/js/debug/validator.js index a77b6f42..7a963f82 100644 --- a/framework/Web/Javascripts/js/debug/validator.js +++ b/framework/Web/Javascripts/js/debug/validator.js @@ -756,9 +756,9 @@ Prado.WebUI.TBaseValidator.prototype = return value;
},
- /**
+ /**
* The ControlType property comes from TBaseValidator::getClientControlClass()
- * Be sure to update the TBaseValidator::$_clientClass if new cases are added.
+ * Be sure to update the TBaseValidator::$_clientClass if new cases are added.
* @return mixed control value to validate
*/
getValidationValue : function(control)
@@ -771,11 +771,11 @@ Prado.WebUI.TBaseValidator.prototype = if(control.type == "text")
{
value = this.trim($F(control));
-
- if(this.options.DateFormat)
+
+ if(this.options.DateFormat)
{
date = value.toDate(this.options.DateFormat);
- return date == null ? '' : date;
+ return date == null ? value : date;
}
else
return value;
@@ -1116,7 +1116,7 @@ Prado.WebUI.TRangeValidator = Class.extend(Prado.WebUI.TBaseValidator, return true;
if(typeof(this.options.DataType) == "undefined")
this.options.DataType = "String";
-
+
if(this.options.DataType != "StringLength")
{
var min = this.convert(this.options.DataType, this.options.MinValue || null);
@@ -1129,7 +1129,7 @@ Prado.WebUI.TRangeValidator = Class.extend(Prado.WebUI.TBaseValidator, var max = this.options.MaxValue || Number.POSITIVE_INFINITY;
value = value.length;
}
-
+
if(value == null)
return false;
@@ -1268,10 +1268,10 @@ Prado.WebUI.TDataTypeValidator = Class.extend(Prado.WebUI.TBaseValidator, {
evaluateIsValid : function()
{
- var value = this.getValidationValue();
- if(value.length <= 0)
- return true;
- return this.convert(this.options.DataType, value) != null;
+ value = this.getValidationValue();
+ if(value.length <= 0)
+ return true;
+ return this.convert(this.options.DataType, value) != null;
}
});
diff --git a/framework/Web/Javascripts/prado/validation3.js b/framework/Web/Javascripts/prado/validation3.js index 139f99f1..6e9dfc0a 100644 --- a/framework/Web/Javascripts/prado/validation3.js +++ b/framework/Web/Javascripts/prado/validation3.js @@ -756,9 +756,9 @@ Prado.WebUI.TBaseValidator.prototype = return value;
},
- /**
+ /**
* The ControlType property comes from TBaseValidator::getClientControlClass()
- * Be sure to update the TBaseValidator::$_clientClass if new cases are added.
+ * Be sure to update the TBaseValidator::$_clientClass if new cases are added.
* @return mixed control value to validate
*/
getValidationValue : function(control)
@@ -771,11 +771,11 @@ Prado.WebUI.TBaseValidator.prototype = if(control.type == "text")
{
value = this.trim($F(control));
-
- if(this.options.DateFormat)
+
+ if(this.options.DateFormat)
{
date = value.toDate(this.options.DateFormat);
- return date == null ? '' : date;
+ return date == null ? value : date;
}
else
return value;
@@ -1116,7 +1116,7 @@ Prado.WebUI.TRangeValidator = Class.extend(Prado.WebUI.TBaseValidator, return true;
if(typeof(this.options.DataType) == "undefined")
this.options.DataType = "String";
-
+
if(this.options.DataType != "StringLength")
{
var min = this.convert(this.options.DataType, this.options.MinValue || null);
@@ -1129,7 +1129,7 @@ Prado.WebUI.TRangeValidator = Class.extend(Prado.WebUI.TBaseValidator, var max = this.options.MaxValue || Number.POSITIVE_INFINITY;
value = value.length;
}
-
+
if(value == null)
return false;
@@ -1268,10 +1268,10 @@ Prado.WebUI.TDataTypeValidator = Class.extend(Prado.WebUI.TBaseValidator, {
evaluateIsValid : function()
{
- var value = this.getValidationValue();
- if(value.length <= 0)
- return true;
- return this.convert(this.options.DataType, value) != null;
+ value = this.getValidationValue();
+ if(value.length <= 0)
+ return true;
+ return this.convert(this.options.DataType, value) != null;
}
});
diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php index 3e91ec15..ec39e8a3 100644 --- a/framework/Web/UI/WebControls/TDataTypeValidator.php +++ b/framework/Web/UI/WebControls/TDataTypeValidator.php @@ -91,7 +91,7 @@ class TDataTypeValidator extends TBaseValidator {
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 0c3e0b9a..b6daa164 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -317,14 +317,14 @@ class TDatePicker extends TTextBox /**
* Returns the value to be validated.
* This methid is required by IValidatable interface.
- * @return integer the value of the property to be validated.
+ * @return integer the interger timestamp if valid, otherwise the original text.
*/
public function getValidationPropertyValue()
{
- if($this->getText() === '')
+ if(($text = $this->getText()) === '')
return '';
$date = $this->getTimeStamp();
- return $date == null ? '' : $date;
+ return $date == null ? $text : $date;
}
/**
|