Sunday, June 26, 2011

Re: My Model doesn't validate anything

omit the required part (and its not an array anyway!)

use allowEmpty=>false instead


On 24 Jun., 21:45, Ciul <luiscarlosj...@gmail.com> wrote:
> Hi CakePHP pals.
>
> I'm reading about CakePHP, I come from CodeIgniter and well, I've
> liked a lot what I've seen until now.
>
> I am following examples for Model Data Validation through the
> $validate var but I don't what I might be doing wrong but my model
> doesn't validate anything, I mean, it throws error for every field,
> even for date one and that's already put by CakePHP form helper so no
> way it is not a validate date data.
>
> Here is the validate data I have in my User model.
>
> var $validate = array(
>                         'name' => array(
>                                 'alphaNumeric'  => array(
>                                         'rule'          => 'alphaNumeric',
>                                         'required'      => array(true),
>                                         'message'       => 'The title may not contain any symbols'
>                                 ),
>                                 'maxLength'             => array(
>                                         'rule'          => array('maxLength', 80),
>                                         'message'       => 'The title must not exceed 80 characters'
>                                 )
>                         ),
>                         'date' => array(
>                                 'rule'                  => 'date',
>                                 'required'              => array(true),
>                                 'message'               => 'You must suply a valid date'
>                         ),
>                         'content' => array(
>                                 'required'              => array(true)
>                         )
>                 );

--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: