Yii 2 Field

What is the purpose of Yii 2 Fields what are they really used for?

To create form input you have two options, either to use ActiveForm field function or create it directly from Html object.

this link describe field function (Field Function), it take model and attriblete, and return input.

you can create the HTML input without model, like this code:


<?php echo Html::textInput('name' , 'value', ['id' => 'textInput']); ?>