Web Development

A ton of people are now using Bootstrap for prototyping and also for production sites. In Yii Framework, most often than not, you’d be getting your hands dirty customizing output.

The errorSummary() is the Yii Framework’s way to output errors.

Method 1

<?php echo $form->errorSummary($order, '<strong>Please fix the errors on the form:</strong><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>', '', array('class' => 'alert alert-danger')); ?>

Method 2

<?php echo $form->errorSummary($order, '<strong>Please fix the errors on the form:</strong><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button><div class="alert alert-danger">', '</div>'); ?>

Both the methods would produce:

<div class="alert alert-danger">
  <strong>Please fix the errors on the form:</strong>
  <button type="button" class="close" data-dismiss="alert">
    <span aria-hidden="true">×</span>
    <span class="sr-only">Close</span>
  </button>
  <ul>
    <li>First Name cannot be blank.</li>
    <li>Last Name cannot be blank.</li>
    <li>Street cannot be blank.</li>
    <li>Province State cannot be blank.</li>
    <li>City cannot be blank.</li>
  </ul>
</div>