summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TDataTypeValidator.php
diff options
context:
space:
mode:
authorxue <>2006-04-25 01:27:04 +0000
committerxue <>2006-04-25 01:27:04 +0000
commit1afc913c386bba8e6072c278b0eb4fd9818ab310 (patch)
tree40cc63eb41f47e0ac392c692619640dca57cd262 /framework/Web/UI/WebControls/TDataTypeValidator.php
parentfd019bf034ef4dbedfc305c77fed0dbd83a732c4 (diff)
Undo previous checkin (which goes int 3.0 branch and will be merged back).
Diffstat (limited to 'framework/Web/UI/WebControls/TDataTypeValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TDataTypeValidator.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php
index d78be7bf..81c23ce4 100644
--- a/framework/Web/UI/WebControls/TDataTypeValidator.php
+++ b/framework/Web/UI/WebControls/TDataTypeValidator.php
@@ -23,6 +23,7 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator');
* The following data types are supported:
* - <b>Integer</b> A 32-bit signed integer data type.
* - <b>Float</b> A double-precision floating point number data type.
+ * - <b>Currency</b> A decimal data type that can contain currency symbols.
* - <b>Date</b> A date data type.
* - <b>String</b> A string data type.
* For <b>Date</b> type, the property {@link setDateFormat DateFormat}
@@ -45,13 +46,12 @@ class TDataTypeValidator extends TBaseValidator
}
/**
- * Sets the data type (Integer, Float, Date, String) that the values being
- * compared are converted to before the comparison is made.
+ * Sets the data type (Integer, Float, Currency, Date, String) that the values being compared are converted to before the comparison is made.
* @param string the data type
*/
public function setDataType($value)
{
- $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','String'),'String');
+ $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','Currency','String'),'String');
}
/**
@@ -85,6 +85,8 @@ class TDataTypeValidator extends TBaseValidator
return preg_match('/^[-+]?[0-9]+$/',trim($value));
case 'Float':
return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
+ case 'Currency':
+ return preg_match('/[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
case 'Date':
$dateFormat = $this->getDateFormat();
if(strlen($dateFormat))