From b0744e3ffc412d4f8f706f8e75242509798bf21d Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 21 Jul 2006 15:31:21 +0000 Subject: fixed #206. --- HISTORY | 1 + framework/Web/UI/WebControls/TBaseValidator.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 6c5f0f33..dbfd8106 100644 --- a/HISTORY +++ b/HISTORY @@ -4,6 +4,7 @@ BUG: Ticket#264 - Typos in some exception throw statements (Knut) BUG: Ticket#268 - THttpResponse.redirect() may fail for some browsers (Qiang) BUG: TDataGrid may complain getting ItemType on a non-object if the grid is not data-bound (Qiang) BUG: TCheckBox.Value should be converted to string (Qiang) +CHG: Ticket#206 - TBaseValidator.OnValidate is raised only when the validator is visible (Qiang) ENH: Ticket#220 - TClientScripts method to import custom javascript files (Wei) ENH: Ticket#225 - TRadioButton::getRadioButtonsInGroup() added (Wei) ENH: Ticket#223 - Use TRequiredFieldValidator for TRadioButtons with GroupName property (Wei) 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