The return value from the model's custom validation method becomes the custom message.
HTH, Paul @phpMagpie On Sep 2, 8:40 pm, Christophe Vandeplas <christo...@vandeplas.com> wrote: > Hello, > > I have a model where a field needs a valudation rule to verify if the > value already exists. > The easy way to implement this is by using the isUnique validation. > > However I want to also modify the message the user gets to give him an > url to a location where that value/field is already used. > So instead of a message like "Sorry this is already used." > I want to tell "Sorry this is already used, check out this place {URL} > to see it." > > I tried to play with the $this variable in a custom validation, > however > $this->validate['value']['unique']['message'] = "foo"; > doesn't change the message when I set it from inside the validation > rule. > > function signatureExists($check) { > debug($this->validate); > $this->validate['value']['unique']['message'] = "foo"; > return $this->isUnique($check); > } > > Is there a (supported or unsupported) way to change the validation > rule? > Of course I'd like to keep it in my model and not in my view for > cleanness of code. > > Thanks a lot for your expertise. > Have a great day > > Christophe -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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