$model->field('activated');

This makes a select on the database and if you set $model->id before
you should get the activated status of this id. Maybe if you dont set
the id it selects the first entry. http://book.cakephp.org/de/view/453/field

$this->data['TermolinoWord']['activated'];

This comes out of a form and represents the status of the checkbox in
this form.

So these two things are different and shouldnt get the same result.

On 27 Aug., 13:54, psybear83 <[email protected]> wrote:
> Hi all
>
> I have a checkbox "activated" in my "TermolinoWord" model. I'd like to
> make some custom validation in the controller where I check if the
> checkbox is checked or not.
>
> I wanted to simply check the value of the model object using 
> $model->field("activated"), but for an unknown reason it always returns 1,
>
> regardless whether it's checked or not! When using $this-
>
> >data['TermolinoWord']['activated'], it works as expected:
>
> $model =& $this->{$this->modelClass};
> echo $model->field('activated'); // always 1
> echo $this->data['TermolinoWord']['activated']; // 1 when checked, 0
> when unchecked
>
> What's the problem here?
>
> Thanks a lot for help,
> Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to