From 10420d2bcde1a7437b58175f417170b2d6d93e50 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 9 Jan 2006 03:16:41 +0000 Subject: --- .gitattributes | 1 + .../Web/UI/WebControls/TRequiredFieldValidator.php | 29 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 framework/Web/UI/WebControls/TRequiredFieldValidator.php 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 @@ +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 -- cgit v1.2.3