No error message show in yii2

Steward Chan picture Steward Chan · Jun 17, 2015 · Viewed 7.3k times · Source

I cann't not show the error message.

This is my site code.

<div class="login_wrapper">
<div class="row">
    <div class="left_block">
        <div class="row">
            <form class="col-md-12 col-sm-12 col-xs-12">
                <h2 class="login_heading">Login</h2>
                <div class="row">
                    <?php $form = ActiveForm::begin([
                        'fieldConfig' => [
                            'template' => "{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}",
                        ]]); ?>
                    <div class="input-field col-md-12 col-sm-12 col-xs-12">
                        <?= $form->field($model, 'username', [
                            'inputTemplate' => '<i class="ion-person prefix"></i>{input}<label for="icon_prefix-2" >
                            Username</label>',])->textInput(['id' => 'icon_prefix-2', 'class'=>' validate', 
                            'autocomplete' => 'off'])?>
                    </div>
                    <div class="input-field col-md-12 col-sm-12 col-xs-12">
                        <?= $form->field($model, 'password', [
                            'inputTemplate' => '<i class="ion-locked prefix"></i>{input}<label for="icon_prefix-2" >
                            Password</label>',])->passwordInput(['id' => 'icon_prefix-3', 'class'=>'validate', 
                            'autocomplete' => 'off', 'onpaste' => 'return false']) ?>
                    </div>                                
                    <div class="clearfix"></div>
                    <?= Html::submitButton('Login', ['class' => 'btn btn-primary btn-block', 'name' => 'login-button']) ?>
                    <?php ActiveForm::end(); ?>
                </div>
            </form>
        </div>
    </div>
</div>

It does not show the error message even I empty all the input field.

Answer

scaisEdge picture scaisEdge · Jun 17, 2015

Check if in yourApp/web/index.php these are setting :

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

and look in Yii debugger