Where do you set the data for the model ?
like $this->Model->create($this->data); OR
$this->Model->set($this->data) OR
or $this->Model->save($this->data) ?

also use the new validation approach in 1.2
http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-field-in-cakephp-1-2

and $form->input already shows the error by itself - you don't need to
add form->error

On Aug 12, 1:50 am, stefano <[EMAIL PROTECTED]> wrote:
> i have this
>
>     var $validate = array(
>                 'username' => '/[a-z0-9\_\-]{3,}$/i',
>                 'passwd' => VALID_NOT_EMPTY,
>                 'name' => VALID_NOT_EMPTY,
>                 'lastname' => VALID_NOT_EMPTY,
>                 'city' => VALID_NUMBER,
>                 'email' => VALID_EMAIL,
>         );
>
> on my model and in the database
>
> CREATE TABLE `users` (
>   `id` int(10) unsigned NOT NULL auto_increment,
>   `username` varchar(50) NOT NULL default '',
>   `passwd` varchar(32) NOT NULL default '',
>   `name` varchar(50) NOT NULL default '',
>   `lastname` varchar(100) NOT NULL,
>   `email` varchar(100) NOT NULL default '',
>   `city` varchar(150) NOT NULL,
>   `last_visit` datetime NOT NULL default '0000-00-00 00:00:00',
>   `group_id` int(10) unsigned NOT NULL default '0',
>   `active` tinyint(1) unsigned NOT NULL default '0',
>   `created` datetime NOT NULL default '0000-00-00 00:00:00',
>   `modified` datetime NOT NULL default '0000-00-00 00:00:00',
>   PRIMARY KEY  (`id`),
>   UNIQUE KEY `username` (`username`),
>   UNIQUE KEY `email` (`email`,`username`),
>   KEY `group_id` (`group_id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
>
> and when i did a submit just created and modified are stored :(
>
> On 11 ago, 18:54, francky06l <[EMAIL PROTECTED]> wrote:
>
> > What validations do you have in your model ? You should not need to
> > call  $this->validateErrors($this->User)..
> > By the way, are you data saved in the table?
>
> > On Aug 12, 12:00 am, stefano <[EMAIL PROTECTED]> wrote:
>
> > > ups i know this die() was for debug :P the is without this die() and
> > > pr();
> > >  but i still have this problem :(
>
> > > On 11 ago, 14:18, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > well your model can't save the data if you use the code posted.
> > > > The    die(); prevents the save to be executed.
> > > > remove the call to die();
>
> > > > On Aug 11, 7:33 pm, stefano <[EMAIL PROTECTED]> wrote:
>
> > > > > hello i have a litle problem with validation data in cakephp1.2
>
> > > > > i know that is a noob problem but i can't fix it
>
> > > > > i have this controller
>
> > > > > var $uses = array('User');
>
> > > > >    function index() {
>
> > > > >       $ciudades = array(1=>"ConcepciĆ³n",2=>"Hualpen");
> > > > >           $this->set("ciudades",$ciudades);
>
> > > > >           if (empty($this->data)) {
> > > > >          $this->render();
> > > > >           }
> > > > >       else {
> > > > >         pr($this->data);
> > > > >         die();
> > > > >         $this->data['User']['active'] = 0;
> > > > >         $this->data['User']['passwd'] = md5($this->data['User']
> > > > > ['passwd']);
>
> > > > >         if($this->User->save()) {
>
> > > > >         }
> > > > >         else {
> > > > >                         $this->validateErrors($this->User);
> > > > >                         $this->render();
> > > > >         }
> > > > >       }
> > > > >    }
>
> > > > >  and
>
> > > > > my index.ctp
>
> > > > > echo "<h4>email</h4>";
> > > > > echo $form->input("User/email",array('label' => false,'size'=>20));
> > > > > echo $form->error("User/email","Ingresa un email valido",array('label'
> > > > > => false));
>
> > > > > the problem is that cakephp is not validating the form :(
>
> > > > > sorry for my bad english and my noob question :P


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