registcn
(Registn)
1
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…
amit5992
(Gupta5992amit)
3
try this…
<?php $form = ActiveForm::begin([
'layout' => 'horizontal',
]);
?>
registcn
(Registn)
4
thx,but as far as i know activeform has no attributes of ‘layout’
amit5992
(Gupta5992amit)
5
Sorry, i forgot to tell you …
use bootstrap ActiveForm…
use yii\bootstrap\ActiveForm;
registcn
(Registn)
6
then do i need to change codes in otherwhere(such as controller and model) besides the view file?
amit5992
(Gupta5992amit)
7
other solution is …
<?php $form = ActiveForm::begin([
'id' => 'form',
'options' => ['class' => 'form-horizontal'],
]); ?>
registcn
(Registn)
9
i tried as:http://www.yiiframework.com/doc-2.0/yii-bootstrap-activeform.html
not working~~~ would you please give some codes?
amit5992
(Gupta5992amit)
10
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%;}