T
T
Theory Theory2020-08-23 08:20:07
Yii
Theory Theory, 2020-08-23 08:20:07

Why does ActiveForm work with $model?

In the controller we create a $model object and call render(form, ['model' => $model])
And then pass this object and property to the ActiveForm field But why does an ActiveForm need a $model and a property?? After all, it just generates an html input field
<?= $form->field($model, 'name') ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
smigles, 2020-08-23
@Narbek

The name is taken from the model for the field, the text for the label, as well as the validation rules that will work in JS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question