Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html textbox without model in Yii2

Tags:

yii2

I just moved to Yii2. How to make text box like this:

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

but without using any model?

like image 259
24 revs, 19 users 31% Avatar asked Dec 04 '15 04:12

24 revs, 19 users 31%


2 Answers

Use yii\helpers\Html and Try something like,

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

textInput()

like image 146
Insane Skull Avatar answered Oct 23 '22 18:10

Insane Skull


I would add a label and the form-control Bootstrap class:

<?= Html::label('Person', 'xxx') ?>
<?= Html::textInput('xxx', value, ['class' => 'form-control']) ?>
like image 7
Roby Sottini Avatar answered Oct 23 '22 19:10

Roby Sottini