diff options
Diffstat (limited to 'framework/Web/UI/WebControls')
| -rw-r--r-- | framework/Web/UI/WebControls/TCheckBoxList.php | 34 | 
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 | 
