diff options
author | ctrlaltca@gmail.com <> | 2012-01-18 09:35:07 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2012-01-18 09:35:07 +0000 |
commit | a26837b0990f65b7091263026296d2aff68d9838 (patch) | |
tree | 3eea57ec60f9c7136a42183e1f6d057a0a1bc997 /framework | |
parent | e3e61542d5a5292b12c987998326f686a5e11d81 (diff) |
fixed #380 (TCustomValidator's ControlToValidate should be optional); added a quickstart example, updated 2 tests that were broken + HISTORY
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 11 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TCustomValidator.php | 5 |
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();
}
/**
|