bug in CFormInputElement.php

In version 1.1.5

file "CFormInputElement.php"

Line 153




public function render()

	{

		if($this->type==='hidden')

			return $this->renderInput();

		$output=array(

			'{label}'=>$this->renderLabel(),

			'{input}'=>$this->renderInput(),

			'{hint}'=>$this->renderHint(),

			'{error}'=>$this->getParent()->showErrorSummary ? '' : $this->renderError(), //<--here

		);

		return strtr($this->layout,$output);

	}



should be




'{error}'=>$this->getParent()->showErrorSummary ? $this->renderError() : '', //<--here



Please confirm that the correction ive made is correct

The error kept me from using the renderBody methos of Cform, with the correction everything is fine!!

Good catch… the correnction is good… fixed in trunk - http://code.google.com/p/yii/source/detail?r=2803

Ops… it’s not a bug… it’s by design… see the comment of Qiang - http://code.google.com/p/yii/source/detail?r=2803

ok

but in this case what makes "getActiveFormWidget()" return null when using renderBody() instead of render();


public function renderError()

	{

		$parent=$this->getParent();

		return $parent->getActiveFormWidget()->error($parent->getModel(), $this->name, $this->errorOptions);

	}