summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php11
-rw-r--r--framework/Web/UI/WebControls/TCustomValidator.php5
2 files changed, 9 insertions, 7 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index c90f4d9d..6e4e8f71 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -163,7 +163,8 @@ abstract class TBaseValidator extends TLabel implements IValidator
$options['FocusElementID'] = $this->getFocusElementID();
}
$options['ValidationGroup'] = $this->getValidationGroup();
- $options['ControlToValidate'] = $control->getClientID();
+ if($control)
+ $options['ControlToValidate'] = $control->getClientID();
$options['ControlCssClass'] = $this->getControlCssClass();
$options['ControlType'] = $this->getClientControlClass($control);
@@ -499,8 +500,11 @@ abstract class TBaseValidator extends TLabel implements IValidator
$this->onValidate();
if($this->getVisible(true) && $this->getEnabled(true))
{
+ $target=$this->getValidationTarget();
// if the target is not a disabled web control
- if(($target=$this->getValidationTarget())!==null && !($target instanceof TWebControl && !$target->getEnabled(true)))
+ if($target===null ||
+ ($target!==null &&
+ !($target instanceof TWebControl && !$target->getEnabled(true))))
{
if($this->evaluateIsValid())
{
@@ -509,7 +513,8 @@ abstract class TBaseValidator extends TLabel implements IValidator
}
else
{
- $target->setIsValid(false);
+ if($target)
+ $target->setIsValid(false);
$this->setIsValid(false);
$this->onValidationError();
}
diff --git a/framework/Web/UI/WebControls/TCustomValidator.php b/framework/Web/UI/WebControls/TCustomValidator.php
index 7d0c8234..cc11c7a6 100644
--- a/framework/Web/UI/WebControls/TCustomValidator.php
+++ b/framework/Web/UI/WebControls/TCustomValidator.php
@@ -107,10 +107,7 @@ class TCustomValidator extends TBaseValidator
{
$param=new TServerValidateEventParameter($value,true);
$this->raiseEvent('OnServerValidate',$this,$param);
- if($this->getValidationTarget()==null)
- return true;
- else
- return $param->getIsValid();
+ return $param->getIsValid();
}
/**