Answer the question
In order to leave comments, you need to log in
How to set model attribute value to variable in controller without form in view?
There are several forms on the view, the values of which are passed to the model attributes (scenario[add]).
It is necessary to set the value of one of the attributes (country_id) equal to a variable, that is, do not create a form for it, but simply hard-link it to the same value for all additions of records to the database.
I'm new to Yii2, please be more detailed... Thank you.
Answer the question
In order to leave comments, you need to log in
The value of an attribute missing in the form can be set, for example, using the DefaultValidator
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question