diff options
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()
|