summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TCheckBoxList.php
diff options
context:
space:
mode:
authortof <>2008-04-18 08:17:29 +0000
committertof <>2008-04-18 08:17:29 +0000
commit06d1e0831eed56e810dfc774e9505cd5bfd9b0ce (patch)
treeafb388762020a9136790353fb56c922c32545463 /framework/Web/UI/WebControls/TCheckBoxList.php
parent3a1df7d7c4b8fb7f5bd7884afa658ae324329e4f (diff)
More fixes for #828
Diffstat (limited to 'framework/Web/UI/WebControls/TCheckBoxList.php')
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php34
1 files changed, 31 insertions, 3 deletions
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