How to show universally errorSummary ?


how to universally errorSummary?

Example: I have different models in one view, $modelUser, $modelCars. I would call errorSummary the layout for a consistent display of errors.

I do not write

if ($modelUser) echo $form->errorSummary($modelUser);

if ($modelCars) echo $form->errorSummary($modelCars);

Optimally errorSummary () for all models in the current view.

Is there a solution?

thank you

I think you have to create two objects for both models and

then send that to model object to perticular view.

$model_first=new first();

$model_second=new second();


Yes, this is the standard solution when errorSummary in my view. But I’d like errorSummary level layout without having to identify specific models.

I think for this you have to include it in modules main file and import all models in that modules controller file.

i don’t know anthying about this.

[color="#008000"]NOTE: moved to proper section (General Discussion for Yii 1.1.x instead of Tips, Snippets and Tutorials)[/color]

  1. You can can show the errorSummary for an array of models;

$models = array($model1,$models2,…)


  1. I think in your view you don’t work with a unknown list of models, you have to know which models to work with.

    So why you want a universally solution?

    But if you want you can try with the php function get_defined_vars(). But I wouldn’t do that, because of the ‘overhead’

$models = array();

foreach(get_defined_vars() as $var)

    if($var instanceof CModel)

        $models[] = array();