summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TBaseValidator.php
diff options
context:
space:
mode:
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