error('User\uid'); You have a backslash there. Try 'User.uid'
On Thu, May 29, 2008 at 7:05 PM, venkat <[EMAIL PROTECTED]> wrote: > > I use $this->Model->validate() > The error is not getting o/p to the view > in view i am able to o/p the validationErrors using $form- >>validationErrors > > Any help > > Model > -------------- > [code] > var $primaryKey = 'uid'; > var $validate = array( > 'uid' => array( > 'alphanumeric' => array( > 'rule' => 'alphanumeric', > 'message' => 'Username may only consist of letter and > numbers'), > VALID_NOT_EMPTY => array( > 'rule' => VALID_NOT_EMPTY, > 'required' => true, > 'message' => 'Username Can not be Empty') > ), > 'password' => array( > VALID_NOT_EMPTY => array( > 'rule' => VALID_NOT_EMPTY, > 'required' => true, > 'message' => 'Password Can not be Empty') > ) > ); > [/code] > > Controller > --------------- > [code] > function login(){ > $this->set('error', false); > if (!empty($this->data)) > { > $this->User->set($this->data); > if($this->User->validates()){ > //Validation OK > $someone = > $this->User->ValidateLogin($this->User); > if($someone != false) > { > > $this->Session->write('User',$someone['User']) ; > > if($this->LoginLog->UpdateLoginLog($someone['User']['pk_User_ID'], > $this->Session->id())){ > $this->redirect('/main'); > } > else{ > $this->set('error', true); > $this->set('errorMessage', > 'Unexpected Error: Please Get In > Touch with Administrator'); > } > } > else{ > $this->set('error', true); > $this->set('errorMessage', 'The login > credentials you supplied > could not be recognized. Please try again.'); > } > } > else { > //$this->Post > $errors = $this->User->invalidFields(); > print_r($errors); > print_r('validation not ok'); > } > } > } > [/code] > > View > --------- > [code] > <tr> > <td>UserName</td> > <td><?php echo $form->text('uid', array('size' => '20'));echo $form- >>error('User\uid'); ?> </td> > </tr> > [/code] > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---