Yii Framework Forum: CForm, validation and 1.1.0 vs 1.1.1 - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CForm, validation and 1.1.0 vs 1.1.1 Rate Topic: -----

#1 User is offline   Lafriks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-March 10

Posted 20 March 2010 - 02:08 PM

I have CForm configuration file:
<?php
return array (
    'title' => 'Order',
    'showErrorSummary' => true,
    'elements' => array
    (
...


In yii 1.1.0 when showErrorSummary was set to true it did show only error message in error summary, but now after upgrading to 1.1.1 it does show error message in error summary and near input box.

I don't know if it's some kind of feature or bug but what can be done to get back to 1.1.0 behavior?
0

#2 User is offline   Lafriks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-March 10

Posted 23 March 2010 - 04:13 PM

anyone, please?
0

#3 User is offline   Lived 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-November 09

Posted 28 April 2010 - 04:30 PM

Well, in the file 'yii\framework\web\form\CFormInputElement.php' change string:

public function render()
{
	if($this->type==='hidden')
		return $this->renderInput();
	$output=array(
		'{label}'=>$this->renderLabel(),
		'{input}'=>$this->renderInput(),
		'{hint}'=>$this->renderHint(),
		'{error}'=>$this->renderError(), // <--- that string
	);
	return strtr($this->layout,$output);
}

to:

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

Solution is taken from here.
I am surprised that developers have missed this moment.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users