how to let activefiled's errorinfo show at right of input

I need to change template of the filed,but how to set it?

Do i need to write css myself?

Or just change


ActiveForm::begin([

                      'fieldConfig' => [

                           'template'=>'{input}\n{error}',

                       ]

]

to


ActiveForm::begin([

                      'fieldConfig' => [

                           'template'=>'{input}{error}',

                       ]

],

but,after deleting ‘\n’,the still in two lines…

is there anybody?

try this…




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

    'layout' => 'horizontal',

]);

?>

thx,but as far as i know activeform has no attributes of ‘layout’

Sorry, i forgot to tell you …

use bootstrap ActiveForm…


use yii\bootstrap\ActiveForm;

then do i need to change codes in otherwhere(such as controller and model) besides the view file?

other solution is …





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

    'id' => 'form',

    'options' => ['class' => 'form-horizontal'],

]); ?>



No…

i tried as:http://www.yiiframework.com/doc-2.0/yii-bootstrap-activeform.html

not working~~~ would you please give some codes?

try this …

_form.php




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

    'id' => 'form',

    'options' => ['class' => 'form-horizontal'],

]); ?><?= $form->field($model, 'username',['template' => "{label} {input} {error} "])->textInput() ?>

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

.css file

override bootstrap css with this


.form-control {    float: left !important;    width: 25%;}