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