thanks for the suggestions.

I tried to handle the comment validation in my Post model however this
does not work. It simply ignore all the validation rules.
When I handle validation in the Comment model everything works, it
just does not show the errors.

any other suggestions?

On Feb 2, 10:39 am, EchoChargen <[EMAIL PROTECTED]> wrote:
> Neil -
> I am new Cake user, but I was able to get validation working with
> forms for different models.
> By setting the error messages in the model.  Here's a snip from my
> User model:
>                 'city' => array(
>                         'required' => array(
>                                 'rule' => array('minLength', '1'),
>                                 'last' => true,
>                                 'message' => 'Please enter your city'),
>                         'alphanumericplus' => array(
>                                 'rule' => array('custom','/^[a-z0-9\- ]*$/i'),
>                                 'last' => true,
>                                 'message' => 'Only letters, numbers, spaces 
> and hyphens allowed'),
>                         'maxlength' => array(
>                                 'rule' => array('maxLength', '50'),
>                                 'last' => true,
>                                 'message' => 'No more than 50 characters'),
>                         ),
> I believe the first "minLength" rule is redundant because looking at
> the docs/api, "allowEmpty" defaults to false.  Maybe someone else will
> comment on that.
>
> In the controller you can check the validation errors by using:
>  $this->User->validationErrors
>
> Not sure if that helps.
> Regards,
> Jeremy
>
> On Feb 1, 9:22 pm, Neil <[EMAIL PROTECTED]> wrote:
>
> > I have a form that allows ppl to add comments to a post. Everything is
> > working fine but it does not display the error messages. I'm guessing
> > it is because my form is calling an action in the comment controller,
> > but it is in a view from my post controller. any tips?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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