yilliot
(Yilliot)
1
Hi, please forgive i am new to yii,
I want to save the $_POST result by CModel. and follow the example it is
$model->attributes = $_POST[‘User’];
OR
$model->setAttributes($_POST[‘User’]);
then
$model->save()
but i found there fields not saved if I didn’t put any rules in the model.
then i try to pass in safe attribute flag
$model->setAttributes($_POST[‘User’], false);
then i found it can save, but the captcha will have error.
sorry, i dont understand about this…
please help
andy_s
(Arekandrei)
2
danaluther
(Dana Luther)
3
For the massive assignment to work, you need to create a rule for the attributes, even if you’re just flagging all the attributes as ‘safe’.
You should really specify more details about what your inputs are though, to help ensure that you’re processing what you expect to process.
yilliot
(Yilliot)
4
everyone, thanks. i understand. 
but why if i flag massive set attribute to false. the captcha will be affected? 
danaluther
(Dana Luther)
5
To skip the captcha validation, you’d need to run $model->save(false);
yilliot
(Yilliot)
6
I see, thank you so much everyone. esp dana.
have a nice day 