I have Post model in which I've defined validation rules:

var $validate = array(
        'range' => array(
        'rule' => array('range', 1900, 2010),
        'message' => 'Between 1900 and 2010.'
    )
);

and I've the PostsController, with an easy add function:
function add() {
        if (!empty($this->data)) {
                if ($this->Post->save($this->data))
                        {
                           // HANDLE SUCCESS
                        }
                        else
                        {
                           // HANDLE VALIDATION ERROR
                           $this->Session->setFlash("generic error");
                        }
                }
        }

How I've to code the 'else' branch to show validation error message
defined inside model?
Especially I would show "between 1900 and 2010." as error rather thn
"generic error"

Regards

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to