Wednesday, November 28, 2012

Re: setting custom error messages for validators in all my projects

Perhaps you could set the default ones up in AppModel, then fold that
into a local $validate array in each child model. But I suppose you'd
need to create a constructor for each model.

Actually, you'd need to define an empty $validate array as well as an
array with a different name, eg. $_validate, for your local rules.
Then, in the constructor, merge that with parent::validate and assign
to $validate.

Or something.

On Tue, Nov 27, 2012 at 8:33 AM, vitor gomes <vitorsgomes@gmail.com> wrote:
> Hi,
>
> I'm starting two different projects using cake, but there are several
> validations in my forms that will be the basically the same, like notempty
> for exemple. I will use Bake to generate my CRUDs.
>
> What I need to know is if there is any option to set custom message errors
> for those default validators and some how don't need to set it in every
> single model in both projects.
>
> There is some option to set custom messages for validators in some place and
> it Cake display everytime I use this validator?
>
> Best regards,
> Vitor.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
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+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: