Displaying individual field errors at the top


I have been shifting my code from yii 1.1 to yii 2.0.

In yii 1.1 it was easier to display errors of any individual attribute anywhere in the form, now in yii 2.0, i am unable to figure out a way to do so.

<?php $form = ActiveForm::begin([

        'id' => 'login-form',

        'enableAjaxValidation' => true,

        'enableClientValidation' => false,

        'validateOnSubmit' => true,

        'validateOnChange' => false,

        'validateOnType' => false


        ]); ?>

    //  Error for username attribute here is not showing

    <?= Html::error($model, 'username', array('class' => 'loginerrors help-block')); ?> 

    <div class="loginForm" id="login1">

        <div class="container">

            <div class="row"> 

                <div class="span4 offset4 control-group" id="username_offset">

                    <?= $form->field($model, 'username')->textInput(); ?>


                <div class="span4 control-group">

                    <?= $form->field($model, 'password')->passwordInput(); ?>


                <div class="span12">

                        <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>





    <?php ActiveForm::end(); ?>

The error at the top for the username attribute is not showing, although inline errors are displaying, can anyone help how to do this? I am using ajaxValidation to validate my form. It seems to be left out, as only in case of ajaxvalidation and clientvalidation it isn’t displaying, but when i submit the form normally, error is displaying. Is this missed or there is an alternate way to do this?