From 06d1e0831eed56e810dfc774e9505cd5bfd9b0ce Mon Sep 17 00:00:00 2001 From: tof <> Date: Fri, 18 Apr 2008 08:17:29 +0000 Subject: More fixes for #828 --- framework/Web/UI/WebControls/TCheckBoxList.php | 34 +++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI/WebControls') diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php index d0f4c7ce..51b363ad 100644 --- a/framework/Web/UI/WebControls/TCheckBoxList.php +++ b/framework/Web/UI/WebControls/TCheckBoxList.php @@ -358,7 +358,27 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont $page->registerRequiresPostData($this->_repeatedControl); } } - + + /** + * Wether the list should be rendered inside a span or not + * + *@return boolean true if we need a span + */ + protected function getSpanNeeded () + { + if ($this->getRepeatLayout()===TRepeatLayout::Raw) + { + $id=$this->getID(); + // Check if we have a validator registered for this control + foreach ($this->getPage()->getValidators() as $v) + { + if ($v->getControlToValidate()===$id) + return true; + } + } + return false; + } + /** * Renders the checkbox list control. * This method overrides the parent implementation. @@ -368,6 +388,11 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont { if($this->getItemCount()>0) { + if ($needSpan=$this->getSpanNeeded()) + { + $writer->addAttribute('id', $this->getClientId()); + $writer->renderBeginTag('span'); + } $this->_isEnabled=$this->getEnabled(true); $repeatInfo=$this->getRepeatInfo(); $accessKey=$this->getAccessKey(); @@ -379,7 +404,9 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont $this->setTabIndex(0); $repeatInfo->renderRepeater($writer,$this); $this->setAccessKey($accessKey); - $this->setTabIndex($tabIndex); + $this->setTabIndex($tabIndex); + if ($needSpan) + $writer->renderEndTag(); } //checkbox skipped the client control script in addAttributesToRender if($this->getEnabled(true) @@ -433,7 +460,8 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont $options['ListName'] = $this->getUniqueID(); $options['ItemCount'] = $this->getItemCount(); return $options; - } + } + } ?> \ No newline at end of file -- cgit v1.2.3