summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TBaseValidator.php
diff options
context:
space:
mode:
authorxue <>2006-07-21 16:14:01 +0000
committerxue <>2006-07-21 16:14:01 +0000
commitc0d9d27f16bae2e428225302da144e9cc6d4adc8 (patch)
treeef7b611d7c87931a3fcfcaf9e4cbb94641640f63 /framework/Web/UI/WebControls/TBaseValidator.php
parent0c16571c091f8c4c89ae18427b2c2994cd4cf3bb (diff)
merge from 3.0 branch till 1281.
Diffstat (limited to 'framework/Web/UI/WebControls/TBaseValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 9366de62..6660184e 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -11,6 +11,11 @@
*/
/**
+ * Using TLabel class
+ */
+Prado::using('System.Web.UI.WebControls.TLabel');
+
+/**
* TBaseValidator class
*
* TBaseValidator serves as the base class for validator controls.
@@ -474,10 +479,10 @@ abstract class TBaseValidator extends TLabel implements IValidator
*/
public function validate()
{
- $this->onValidate();
+ if($visible=$this->getVisible(true))
+ $this->onValidate();
$this->setIsValid(true);
- $control=$this->getValidationTarget();
- if($control && $this->getVisible(true) && $this->getEnabled())
+ if($this->getValidationTarget() && $visible && $this->getEnabled())
{
if($this->evaluateIsValid())
{
@@ -534,6 +539,9 @@ abstract class TBaseValidator extends TLabel implements IValidator
/**
* This event is raised right before the validator starts to perform validation.
+ * You may use this event to change the behavior of validation.
+ * For example, you may disable the validator if certain condition is satisfied.
+ * Note, the event will NOT be raised if the validator is invisible.
*/
public function onValidate()
{
@@ -666,4 +674,4 @@ class TClientSideValidatorOptions extends TClientSideOptions
}
}
-?>
+?> \ No newline at end of file