From 4d8ed423f7b4a8eae2898cc5552829595717a581 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 2 Jan 2006 20:59:17 +0000 Subject: TCheckBoxList and TRadioButtonList completed. --- framework/Web/UI/WebControls/TRadioButtonList.php | 26 +++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'framework/Web/UI/WebControls/TRadioButtonList.php') diff --git a/framework/Web/UI/WebControls/TRadioButtonList.php b/framework/Web/UI/WebControls/TRadioButtonList.php index 8d80745e..e434e709 100644 --- a/framework/Web/UI/WebControls/TRadioButtonList.php +++ b/framework/Web/UI/WebControls/TRadioButtonList.php @@ -2,17 +2,35 @@ class TRadioButtonList extends TCheckBoxList { - protected function createRepeatedControl() + protected function getIsMultiSelect() { - return new TRadioButton; + return false; } - public function loadPostData($key,$values) + protected function createRepeatedControl() { + return new TRadioButton; } - public function raisePostDataChangedEvent() + public function loadPostData($key,$values) { + $value=isset($values[$key])?$values[$key]:''; + $oldSelection=$this->getSelectedIndex(); + $this->ensureDataBound(); + foreach($this->getItems() as $index=>$item) + { + if($item->getEnabled() && $item->getValue()===$value) + { + if($index===$oldSelection) + return false; + else + { + $this->setSelectedIndex($index); + return true; + } + } + } + return false; } } -- cgit v1.2.3