I can’t set the valitationErrors from beforeFilter. Why?
function beforeFilter () {
if ($this->Session->check('errors')) {
$this->validationErrors = array ('Question' => array('text' => 'notEmpty'));
}
}
I tried both “$this->validationErrors” and “$this->Model->validationErrors” and none of them seem to work. When I go to the view, Debug Kit reports that the $this->validationErrors variable is empty.
Nevermind, I just figured it out that when you change validationErrors, the model you use to call it, is the model it will validate. So if you want to validate Questions, you should call $this->Question->validationErrors = …
Thanks everyone. 🙂