qwerty
(qwerty)
1
Hi,
I have member`s model class generated by yiic. I added a captcha attribute to this class.
The problem is when form is validate, because field captcha is not checked (always is that captcha code is not valid)
What should I do to the attribute will check when I call $model->validate()?
Now I do like this:
$model->captcha=$_POST['Member']['captcha'];
...
if($member->validate())
{
...
}
qiang
(Qiang Xue)
2
not sure if I understand you. Do you mean the validation always fails? Did you check if $model->captcha contains correct value?
qwerty
(qwerty)
3
Now it works, but if I not write
$model->captcha=$_POST['Member']['captcha'];
this does not work. Do I have to manually copy data from form to model or can be automatically happen?
qiang
(Qiang Xue)
4
You need to list it in safeAttributes() if you want it to be copied automatically.