Google is your friend. A search for 'cakephp return link in validation error': http://www.google.co.uk/search?q=cakephp+return+link+in+validation+error&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a
To me to: http://stackoverflow.com/questions/6972061/using-htmlhelper-on-model-to-insert-links-in-returned-errors HTH, Paul On Sep 8, 6:50 pm, Christophe Vandeplas <christo...@vandeplas.com> wrote: > On Mon, Sep 5, 2011 at 12:27 PM, WebbedIT <p...@webbedit.co.uk> wrote: > > The return value from the model's custom validation method becomes the > > custom message. > > Thanks Paul, that works indeed. > However I'm still facing a minor problem I can't seem to solve. > > In my error message (the return value) I'd like to give a link to the user. > However the Html object (required to build an url) is not available > from the model. > > Hardcoding the URL in the return value also doesn't work because the > error message gets sanitized (probably htmlspecialchars() ) > > Is there a way to ouput html in an error/validation 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 > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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 > > athttp://groups.google.com/group/cake-php -- 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