TbHtml::errorSummary PHP Method

errorSummary() public static method

Displays a summary of validation errors for one or several models.
public static errorSummary ( mixed $model, string $header = null, string $footer = null, array $htmlOptions = [] ) : string
$model mixed the models whose input errors are to be displayed.
$header string a piece of HTML code that appears in front of the errors.
$footer string a piece of HTML code that appears at the end of the errors.
$htmlOptions array additional HTML attributes to be rendered in the container div tag.
return string the error summary. Empty if no errors are found.
    public static function errorSummary($model, $header = null, $footer = null, $htmlOptions = array())
    {
        // kind of a quick fix but it will do for now.
        self::addCssClass(self::$errorSummaryCss, $htmlOptions);
        return parent::errorSummary($model, $header, $footer, $htmlOptions);
    }

Usage Example

Exemplo n.º 1
0
    <title>Installation</title>

    <link rel="stylesheet" type="text/css" href="<?php 
echo Bootstrap::getBooster()->getAssetsUrl();
?>
/bootstrap/css/bootstrap.min.css" />
</head>
<body>
    <div class="span6 offset3">
        <h1 class="offset1">Installation</h1>
        <h2 class="offset1"><small>Enter admin credentials</small></h2>
        <?php 
if ($model->hasErrors()) {
    ?>
            <?php 
    echo TbHtml::errorSummary($model);
    ?>
        <?php 
}
?>

        <form method="post" class="form-horizontal">

            <?php 
echo TbHtml::activeTextFieldControlGroup($model, 'username');
?>
            <?php 
echo TbHtml::activePasswordFieldControlGroup($model, 'password');
?>
            <?php 
echo TbHtml::activePasswordFieldControlGroup($model, 'password_verify');
All Usage Examples Of TbHtml::errorSummary
TbHtml