Check here: http://book.cakephp.org/view/133/Multiple-Rules-per-Field
(at the bottom) for the recommended method of doing it.

On Dec 26, 10:55 am, si-mon <[email protected]> wrote:
> Thanks John. Thanks Euromark. Really helpful...
>
> On Dec 25, 9:55 pm, John Andersen <[email protected]> wrote:
>
> > I can't agree, as I prefer to have the model be concerned with model
> > things (data, retrieval, saving, validation, etc.), and the view
> > concerned with presenting the data and the related error messages,
> > including the localization!
>
> > Usually I only have one form in which data for a specific model is
> > entered, so the adding a new rule and forgetting to add the
> > localization in the form, does not become an issue! Also, a change is
> > always planned - what to add, what to change, etc.
>
> > But each of us use the technique which we are comfortable with :)
> >    John
>
> > On Dec 25, 4:32 pm, euromark <[email protected]> wrote:
>
> > > i dont like the form-way
> > > it is quite redundant - if you add a new rule you might forget
> > > one or two views which would not be helpful
>
> > > having it all together in the model is in my opinion a cleaner
> > > approach :)
>
> > > On 25 Dez., 12:32, John Andersen <[email protected]> wrote:
>
> > > > Use the form helpers option for the input fields! Look 
> > > > at:http://book.cakephp.org/view/198/options-error
>
> > > > Thus you localize in the view - example:
>
> > > > echo $form->input(
> > > >    'email',
> > > >    array(
> > > >       'label' => __('e-mail address',true),
> > > >       'error' => array('users_email_rule' => __
> > > > ('users_email_rule',true) )
> > > >    )
> > > > ) ;
>
> > > > Observe the 'error' option! Here I use it to convert the validation
> > > > message into the language that the user is viewing the form.
>
> > > > Enjoy,
> > > >    John
>
> > > > On Dec 24, 7:39 pm, si-mon <[email protected]> wrote:
>
> > > > > Hi All,
>
> > > > > Is there a way to use localization for validation messages in the
> > > > > Model $validate array?
>
> > > > > eg: $validate = array ( 'name' => array('rule'=>'notEmpty',
> > > > > 'message'=>'Name is mandatory' ));
>
> > > > > I need the message 'Name is mandatory' in five different languages.
>
> > > > > In other words: How can we use functions like __('message') like
> > > > > functions in model?
>
> > > > > Please help me. Thanks.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to