Saturday, December 3, 2011

Re: Validation rules - what a nightmare...

you should be using "last"=>true for every subrule
http://book.cakephp.org/2.0/en/models/data-validation.html?highlight=last


On 3 Dez., 18:16, heohni <heidi.anselstet...@consultingteam.de> wrote:
> Hi folks!
>
> Whats wrong here?
> var $validate = array(
>         'ben_name' => array(
>             'required' => array('rule' => 'notEmpty', 'message' =>
> 'EmptyName')
>         ),
>         'username' => array(
>             'required' => array('rule' => 'notEmpty', 'message' =>
> 'EmptyEmail', 'required' => true, 'allowEmpty' => false, 'last' =>
> true),
>             'email' => array('rule' => array('email', true), 'message'
> => 'SyntaxEmail'),
>             'unique' => array('rule' => 'isUnique', 'message' =>
> 'EmailNotUnique')
>         ),
>         'password' => array(
>             'required' => array('rule' => 'notEmpty', 'message' =>
> 'EmptyPassword', 'required' => true, 'allowEmpty' => false, 'last' =>
> true),
>             'between' => array('rule' => array('between', 6,15),
> 'message' => 'ToShortPassword')
>         )
>     );
>
> ben_name and username works absoluty fine!
> But the bloody password returns me always the ToShortPassword message,
> regardless what I do, if I leave the field empty, put just 1 letters
> or 20.... whatever I do, I get the ToShortPassword mesasge and I have
> no change to enter something what will pass the validation rule...
>
> I don't see what I am doing wrong! Please help!! Please!!

--
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: