From c0d9d27f16bae2e428225302da144e9cc6d4adc8 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 21 Jul 2006 16:14:01 +0000 Subject: merge from 3.0 branch till 1281. --- framework/Web/UI/WebControls/TBaseValidator.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'framework/Web/UI/WebControls/TBaseValidator.php') 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 @@ -10,6 +10,11 @@ * @package System.Web.UI.WebControls */ +/** + * Using TLabel class + */ +Prado::using('System.Web.UI.WebControls.TLabel'); + /** * TBaseValidator class * @@ -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 -- cgit v1.2.3