how can i add class to errorsummay without remove header message


I'm trying to add a css class to the errorSummary() in yii framwork but after add class i have not header error default<br /> how can i add class to errorsummay without remove header message

<?php echo $form->errorSummary($model, '', '', array('class' => 'alert alert-error')); ?>


Its a very simple one,

you can pass the class you need this way,

<?php echo CHtml::errorSummary($model, null, null, array('class'=>'className')); ?>


<?php echo $form->errorSummary($model, null, null, array('class'=>'className')); ?>

so this will allow you add the class while you have the header.

check here for more information : <a href="http://www.yiiframework.com/doc/api/1.1/CActiveForm#errorSummary-detail" rel="nofollow">http://www.yiiframework.com/doc/api/1.1/CActiveForm#errorSummary-detail</a>

since you are passing, empty string for header it causes the header issue. default value is null for $header.

public string errorSummary(mixed $models, string $header=NULL, string $footer=NULL, array $htmlOptions=array ( ))


you can set attribute <a href="http://yiiapi.com/CActiveForm#errorMessageCssClass-detail" rel="nofollow">errorMessageCssClass</a> of class CActiveForm want:

and also <a href="http://yiiapi.com/CActiveForm#errorSummary-detail" rel="nofollow">errorSummary()</a> has htmlOptions !

public string errorSummary(mixed $models, string $header=NULL, string $footer=NULL, array $htmlOptions=array ( ))


Adjust code like this.

echo $form->errorSummary($model,NULL,NULL,array('class'=>'alert alert-error'));


  • json parse not working
  • Setting default values and Creating into Database using Yii
  • How do you configure pathing in Durandal?
  • yii save dropdown checked state on page refresh
  • how to remove a div with same ids but display='block' and display='none' in JAVa
  • Yii2: Using Kartik Depdrop Widget?
  • getelement by class name for clicking
  • Is looping through all style sheets and classes a good idea in JavaScript?
  • How does this usort cmp function actually work?
  • Stop Bash Script if Hive Fails
  • How to use JavaScript to determine whether a file exists in a directory?
  • How to add git credentials to the build so it would be able to be used within a shell code?
  • Functions in global context
  • FileReader+canvas image loading problem
  • Display Images one by one with next and previous functionality
  • Upload files with Ajax and Jquery
  • jQuery tmpl and DataLink beta
  • Do I've to free mysql result after storing it?
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Compare two NSDates in iPhone
  • Linker errors when using intrinsic function via function pointer
  • A cron job substitute?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • json Serialization in asp
  • SQL merge duplicate rows and join values that are different
  • Proper way to use connect-multiparty with express.js?
  • Benchmarking RAM performance - UWP and C#
  • How to set the response of a form post action to a iframe source?
  • Angular 2 constructor injection vs direct access
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • LevelDB C iterator
  • MATLAB: Piecewise function in curve fitting toolbox using fittype
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • How can i traverse a binary tree from right to left in java?
  • How to Embed XSL into XML
  • How can I use `wmic` in a Windows PE script?
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?