In the yii Framework, when a problem occurs, I assign a value to an attribute of the model in the controller, for example, $ model = new & nbsp; post; $ model-& gt; type = 1; what is used in my view ;? Php & nbsp; $ form = $ this-& gt; beginWidget ('cactiveform', & nbs yii Framework insertion error
I assign a value to a model attribute in the controller:
For example:
$ Model = new post;
$ Model-> type = 1;
In my view
BeginWidget ('cactiveform', array (
'Id' => 'china4a-reg-form ',
'Enableajaxvalidation '=> false,
));
This method is used to obtain the values of other fields.
The submission method is as follows:
IsNewRecord? 'Submit': 'save');?>
However, values in the widget can be correctly inserted into the database, but $ model-> type cannot be inserted.
I haven't tried it for a long time. how can I insert records for this field at the same time? You can also give some advice.
------ Solution --------------------
How do you know if your $ model is outside (maybe it is still inside the method) and you don't pass it?
------ Solution --------------------
Yes. Your $ model-> type needs to be submitted together with other content
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service