How to change CakePHP validation error message -


i have read cakephp documentation validation rules, i'm still stuck changing error message on email field.

i have validation rule in model:

public $validate = array(     'emailadres' => array(         'rule'       => 'email',         'required'   => true,         'allowempty' => false,         'message'    => 'my custom error message'     ) ); 

the field shows being mandatory, standard error message appears instead of custom message.

does see i'm doing wrong?

my cakephp version 2.3.7

you might want double check documentation: http://book.cakephp.org/2.0/en/models/data-validation.html#one-rule-per-field

its not 'rulename' => 'email',, 'rule' => 'email',.

you can try verbose representation:

public $validate = array(     'emailadres' => array(         'email' => array(             'rule'       => 'email',             'required'   => true,             'allowempty' => false,             'message'    => 'my custom error message'         )     ) ); 

Comments