You can try to do $this->invalidate('myField', 'myMessage') in your
myCustomRule() method and do not use 'message' key in $validate for
this rule at all.On Aug 16, 1:11 am, jordicakephp <[email protected]> wrote: > Good afternoon everybody, > > I would like the custom validation functions of my models to return > different error messages, depending on what the user has sent. That > is, to define these messages not in compilation time, but during the > execution of the model's logic. > > I've tried to to that in the beforeValidate() method of the model, > when defining my validation rules, with the help of $errorMessage (a > class variable): > > 'rule' => 'myCustomRule', > 'message' => $this->errorMessage. > > Then, as I say, I manipulate the content of $this->errorMessage inside > myCustomRule, depending on what the user writes. But it doesn't > work... :-( > > Could somebody please give me a clue about how to define many error > messages for just one custom rule? Thanks a lot in advance for your > help! :-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
