I had the same problem. You must be using cake 1.2. It looks like 1.2
doesnt use html helper for forms anymore. Use formHelper class
For information look at the following link:

http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-field-in-cakephp-1-2

and for in depth look at the functions and what not to validate with
look here:
http://cakebaker.42dh.com/2007/01/03/validation-with-cakephp-12/



On May 29, 6:14 am, Eppo <[EMAIL PROTECTED]> wrote:
> The following:
> Cant figure out why validation not working...
>
> This is what i have;
> In my model 'User':
> <?php
> class User extends AppModel{
>         var $name = 'User';
>         var $useTable = 'clients';
>
>         var $validate = array(
>                 'name' => array(array('rule' => array('minLength', 
> 3),'message'=>'No
> name')));
>
>         function beforeValidate(){
>                 if(!isset($this->data['User']['gender'])){
>                         $this->invalidate('gender', 'No gender selected');
>                         return false;
>                 }
>                 return true;index
>         }
> ?>
>
> In my view:
> <?php echo $html->radio('User/gender', array('m', 'v'), '?');?>
> <?php echo $html->tagErrorMsg('User/gender', 'No gender
> selected....'); ?>
>
> But no errors are displayed....
> When I do this in my controller: pr($this); There is an array :
> [validationErrors] => Array(
>     [gender] => No gender selected
> )


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