From b0744e3ffc412d4f8f706f8e75242509798bf21d Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 21 Jul 2006 15:31:21 +0000 Subject: fixed #206. --- framework/Web/UI/WebControls/TBaseValidator.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'framework/Web') diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 9b181a2a..b2405996 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -478,10 +478,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()) { @@ -538,6 +538,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() { -- cgit v1.2.3