D
D
devilsD2020-05-11 16:16:25
Yii
devilsD, 2020-05-11 16:16:25

How to remove formName from input name in activeField yii2?

It is necessary that the name of the input match the name of the attribute. The formName override leaves the [name] brackets;
$form->field($model, 'title');

Ожидаемы результат:
<input type="text" name="title" ?>

Of course, you can make the fields a helper, but I would like it to work globally for the entire form.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-05-11
@devilsD

And why do you need this? This is done so that you can make several forms of different entities and they can be saved without problems. Forms have this method ->formName() override it and return your name or void

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question