[SOLVED] Displaying the error summary outside the form

Hi everyone,

I have this kinda simple problem but I can’t find a solution.

I display my error summary like this:

<?php echo $form->errorSummary($model, NULL, NULL, array("class" => "standard-error-summary")); ?>

So far nothing special, but you can see I need $form to be init like this:

<?php $form = $this->beginWidget("CActiveForm", array("id" => "blabla")); ?>

The problem is when you write this last line of code it will begin a HTML <form>.

So basically I can get the error summary to be displayed after the form (i.e. after endWidget()).

But I want the error summary before the form, so before beginWidget(). Which, of course, does not work as $form does not exists yet.

If someone has any idea how I can find a workaround?


PS: My question can also be, is there a way to init my CActiveForm without running it?


  echo CHtml::errorSummary($model);


Anywhere in your page.

1 Like

Ho! It’s that simple… Thank you.

Sorry for bothering you. :)

I’m quite new to Yii.