diff options
| author | xue <> | 2006-01-24 00:40:46 +0000 | 
|---|---|---|
| committer | xue <> | 2006-01-24 00:40:46 +0000 | 
| commit | 8315c49b766ae0ae4c6729f641f6c83c50636b6c (patch) | |
| tree | 39c700e7d6097ca6b70147952038f470ee799167 /framework/Web/UI/WebControls | |
| parent | 4282256a7bf5580cd0fa22ce9686024352f23a6f (diff) | |
Fixed a few issues with TCheckBox about validator.
Diffstat (limited to 'framework/Web/UI/WebControls')
| -rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 10 | ||||
| -rw-r--r-- | framework/Web/UI/WebControls/TCheckBox.php | 9 | ||||
| -rw-r--r-- | framework/Web/UI/WebControls/TRequiredFieldValidator.php | 2 | 
3 files changed, 5 insertions, 16 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index af8eb7e9..5110230b 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -154,7 +154,7 @@ abstract class TBaseValidator extends TLabel implements IValidator  		$scriptKey = "TBaseValidator:$formID";  		if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey))  		{ -			$scripts->registerClientScript('validator');			 +			$scripts->registerClientScript('validator');  			$scripts->registerEndScript($scriptKey, "Prado.Validation.AddForm('$formID');");  		}  		if($this->getEnableClientScript()) @@ -361,13 +361,7 @@ abstract class TBaseValidator extends TLabel implements IValidator  	protected function getValidationValue($control)  	{  		if($control instanceof IValidatable) -		{ -			$value=$control->getValidationPropertyValue(); -			//if($value instanceof TListItem) -			//	return $value->getValue(); -			//else -				return TPropertyValue::ensureString($value); -		} +			return $control->getValidationPropertyValue();  		else  			throw new TInvalidDataTypeException('basevalidator_validatable_required');  	} diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php index 47fabd20..98084009 100644 --- a/framework/Web/UI/WebControls/TCheckBox.php +++ b/framework/Web/UI/WebControls/TCheckBox.php @@ -76,13 +76,8 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl  	 */
  	public function raisePostDataChangedEvent()
  	{
 -		$page=$this->getPage();
 -		if($this->getAutoPostBack() && !$page->getPostBackEventTarget())
 -		{
 -			$page->setPostBackEventTarget($this);
 -			if($this->getCausesValidation())
 -				$page->validate($this->getValidationGroup());
 -		}
 +		if($this->getAutoPostBack() && $this->getCausesValidation())
 +			$this->getPage()->validate($this->getValidationGroup());
  		$this->onCheckedChanged(null);
  	}
 diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php index df6c2abf..702fc5d2 100644 --- a/framework/Web/UI/WebControls/TRequiredFieldValidator.php +++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php @@ -58,7 +58,7 @@ class TRequiredFieldValidator extends TBaseValidator  	protected function evaluateIsValid()
  	{
  		$value=$this->getValidationValue($this->getValidationTarget());
 -		return trim($value)!==trim($this->getInitialValue());
 +		return trim($value)!==trim($this->getInitialValue()) || (is_bool($value) && $value);
  	}
  	/**
  | 
