From 64d353d1680539fdf3c2d57150f3e93f9f45d84f Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 21 Jan 2006 22:20:51 +0000 Subject: Fixed TImageButton about postbackoptions. --- framework/Web/UI/WebControls/TButton.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'framework/Web/UI/WebControls/TButton.php') diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index 968a783a..b8956739 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -75,12 +75,14 @@ class TButton extends TWebControl implements IPostBackEventHandler if($this->getEnabled(true)) { if($this->canCauseValidation()) + { + $writer->addAttribute('id',$this->getClientID()); $this->getPage()->getClientScript()->registerPostBackControl($this); + } } else if($this->getEnabled()) // in this case, parent will not render 'disabled' $writer->addAttribute('disabled','disabled'); - $writer->addAttribute('id',$this->getClientID()); parent::addAttributesToRender($writer); } @@ -89,9 +91,13 @@ class TButton extends TWebControl implements IPostBackEventHandler */ protected function canCauseValidation() { - $group = $this->getValidationGroup(); - $hasValidators = $this->getPage()->getValidators($group)->getCount()>0; - return $this->getCausesValidation() && $hasValidators; + if($this->getCausesValidation()) + { + $group=$this->getValidationGroup(); + return $this->getPage()->getValidators($group)->getCount()>0; + } + else + return false; } /** -- cgit v1.2.3