This:
       class UserAppModel extends AppModel{

should be:

       class UserModel extends AppModel{

On Jan 30, 2008 8:04 PM, Pq2son2 <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> First Thanks, I'm a newbaby andI read a lot of manuals and the API but
> I don't found the reason because the CakePHP (version 1.2.0.6311)
> doesn't validate any parameter. Here I write the simple exemple that I
> try for test the validation in this framework.
>
> Model:
> <?php
>         class UserAppModel extends AppModel{
>                 var $name="User";
>
>                 var $validate= array(
>                                 'password' => array(
>                                         'rule' => 'alphanumeric',
>                                         'required' => true,
>                                         'allowEmpty' => false,
>                                         'message'=> 'Error!'
>                                 )
>                         );
>         }
> ?>
>
>
> Controller:
> <?php
>
> class UsersController extends AppController{
>         var $name = "Users";
>         var $helpers= array('Html','Form');
>
>         function index(){
>                 if(!empty($this->data)){
>                         $this->User->set($this->data);
>                         if($this->User->validates()){
>                                 echo "No hay ningun error";
>                         }else{
>                                 echo "ERROR!!";
>                         }
>                 }
>         }
> }
> ?>
>
> View:
> <?php echo $form->create('User',array('action'=>'index'));?>
> <?php echo $form->input('password');?>
> <?php echo $form->error('User.password','Aixo no vaaa!! arg!!');?>
> <?php echo $form->submit('Ok');?>
> <?php echo $form->end();?>
>
>
> It's really simply but doesn't work! and I don't know why, if any one
> can found the problem and say it to me, really thanks.
>
> The bakery's that I read are:
> - Validation with CakePHP 1.2: 
> http://cakebaker.42dh.com/2007/01/03/validation-with-cakephp-12/-
> - Multiple Rules of Validation per... :
> http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-field-in-cakephp-1-2
> - CakePHP Manual: http://manual.cakephp.org/chapter/validation
> - And others..... really I don't understand how make it works.
>
> Thanks
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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