summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--framework/Web/UI/WebControls/TRequiredFieldValidator.php29
2 files changed, 30 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
index cf7bc17b..dd6d39c3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -536,6 +536,7 @@ framework/Web/UI/WebControls/TPlaceHolder.php -text
framework/Web/UI/WebControls/TRadioButton.php -text
framework/Web/UI/WebControls/TRadioButtonList.php -text
framework/Web/UI/WebControls/TRepeatInfo.php -text
+framework/Web/UI/WebControls/TRequiredFieldValidator.php -text
framework/Web/UI/WebControls/TStatements.php -text
framework/Web/UI/WebControls/TStyle.php -text
framework/Web/UI/WebControls/TTable.php -text
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