Html text field without model in Yii2

I just switched to Yii2. How to make a text box as follows:

<?= $form->field($model, 'xxx') ?>

but without using any model?

+4
source share
2 answers

Use yii\helpers\Htmland try something like:

<?= Html::textInput('xxx', value, options[]); ?>

textInput ()

+11
source

I would add a label and a form-controlBootstrap class :

<?= Html::label('Person', 'xxx') ?>
<?= Html::textInput('xxx', value, ['class' => 'form-control']) ?>
+2
source

Source: https://habr.com/ru/post/1618525/


All Articles