diff options
author | xue <> | 2006-01-09 03:16:41 +0000 |
---|---|---|
committer | xue <> | 2006-01-09 03:16:41 +0000 |
commit | 10420d2bcde1a7437b58175f417170b2d6d93e50 (patch) | |
tree | 20cc8b7b156031a18b50d3f706de3042a6a77675 /framework/Web | |
parent | be711692b0ac4d3a542f30a54d648af4dc579cfc (diff) |
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/UI/WebControls/TRequiredFieldValidator.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php new file mode 100644 index 00000000..b30de607 --- /dev/null +++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php @@ -0,0 +1,29 @@ +<?php
+
+class TRequiredFieldValidator extends TBaseValidator
+{
+ public function getInitialValue()
+ {
+ $this->getViewState('InitialValue','');
+ }
+
+ public function setInitialValue($value)
+ {
+ $this->setViewState('InitialValue',TPropertyValue::ensureString($value),'');
+ }
+
+ protected function evaluateIsValid()
+ {
+ $value=$this->getValidationValue($this->getValidationTarget());
+ return trim($value)!==trim($this->getInitialValue());
+ }
+
+ protected function getClientScriptOptions()
+ {
+ $options = parent::getClientScriptOptions();
+ $options['initialvalue']=$this->getInitialValue();
+ return $options;
+ }
+}
+
+?>
\ No newline at end of file |