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 --- .../source/prado/validator/validation3.js | 4 --- framework/Web/UI/WebControls/TCheckBoxList.php | 34 ++++++++++++++++++++-- 2 files changed, 31 insertions(+), 7 deletions(-) (limited to 'framework') diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js index 44e175bd..cb6d58c5 100644 --- a/framework/Web/Javascripts/source/prado/validator/validation3.js +++ b/framework/Web/Javascripts/source/prado/validator/validation3.js @@ -607,10 +607,6 @@ Prado.WebUI.TBaseValidator.prototype = this.options = options; this.control = $(options.ControlToValidate); - if (!this.control && this.isListControlType()){ - this.control = $(options.ControlToValidate + '_c0').parentNode; - } - this.message = $(options.ID); if(this.control && this.message) { 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