diff options
author | xue <> | 2006-01-16 05:26:31 +0000 |
---|---|---|
committer | xue <> | 2006-01-16 05:26:31 +0000 |
commit | acfdc83a0bb620d996c80a0787fd515121fcdca0 (patch) | |
tree | 048cdd4248f0110d37006a4c9c2c2306a122aa76 /framework/Web/UI/WebControls/TRequiredFieldValidator.php | |
parent | 6da2f379b1b4ddd0c27db2185ca7408b43a9a97a (diff) |
Added validator controls.
Diffstat (limited to 'framework/Web/UI/WebControls/TRequiredFieldValidator.php')
-rw-r--r-- | framework/Web/UI/WebControls/TRequiredFieldValidator.php | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php index b30de607..c937abf8 100644 --- a/framework/Web/UI/WebControls/TRequiredFieldValidator.php +++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php @@ -1,5 +1,29 @@ <?php
+/**
+ * TRequiredFieldValidator class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ */
+/**
+ * Using TBaseValidator class
+ */
+Prado::using('System.Web.UI.WebControls.TBaseValidator');
+
+/**
+ * TRequiredFieldValidator class
+ *
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0
+ */
class TRequiredFieldValidator extends TBaseValidator
{
public function getInitialValue()
@@ -14,8 +38,13 @@ class TRequiredFieldValidator extends TBaseValidator protected function evaluateIsValid()
{
- $value=$this->getValidationValue($this->getValidationTarget());
- return trim($value)!==trim($this->getInitialValue());
+ if(($control=$this->getValidationTarget())!==null)
+ {
+ $value=$this->getValidationValue($control);
+ return trim($value)!==trim($this->getInitialValue());
+ }
+ else
+ throw new TInvalidDataValueException('requiredfieldvalidator_controltovalidate_invalid');
}
protected function getClientScriptOptions()
|