Wednesday, September 26, 2012

Re: User Model migration

thanks Chetan,... I'll try,...

On Wednesday, September 26, 2012 3:49:06 AM UTC-7, chetan varshney wrote:
For the email validation just use-

'email'=> array(
    'mustNotEmpty'=>array(
    'rule' => 'notEmpty',
    'message'=> 'Please enter email',
    'last'=>true),
    'mustBeEmail'=> array(
    'rule' => array('email'),
    'message' => 'Please enter valid email',
    'last'=>true)
    )

Chetan
Ektasoftwares

On Wed, Sep 26, 2012 at 2:32 PM, Chris <chri...@yahoo.com> wrote:
ok I got it,... but for the last field "email" should I have a same thing...? 

<?php
class User extends AppModel {
  var $name = 'User';
  
  var $validate = array(
    'username' => '/^[a-z0-9\_\-\.]{5,40}$/i',
     'password' => array(
      'rule' => 'notEmpty',
      'message' => 'Please enter a valid user',
     ),
     'firstname' => array(
      'rule' => 'notEmpty',
      'message' => 'Please enter a valid name',
     ),
     'lastname' => array(
      'rule' => 'notEmpty',
      'message' => 'Please enter a valid description',
     ),
     'gender' => array(
      'rule' => 'notEmpty',
      'message' => 'Please enter a valid description',
     ),
     'birthday' => array(
      'rule' => 'notEmpty',
      'message' => 'Please enter a valid description',
     ),
     'location' => array(
      'rule' => 'notEmpty',
      'message' => 'Please enter a valid description',
     ),
     'email' => array(
      'rule' => 'notEmpty',
      'message' => 'Please enter a valid email',
     )
  );



On Wednesday, September 26, 2012 1:57:12 AM UTC-7, Chris wrote:
hi guys,... I have a old version of script written in 1.2 pre-Beta and want to migrate to 1.3,... and have a User Model: 

<?php
class User extends AppModel {
  var $name = 'User';
  
  var $validate = array(
    'username' => '/^[a-z0-9\_\-\.]{5,40}$/i',
    'password' => VALID_NOT_EMPTY,
    'firstname' => VALID_NOT_EMPTY,
    'lastname' => VALID_NOT_EMPTY,
    'gender' => VALID_NOT_EMPTY,
    'birthday' => VALID_NOT_EMPTY,
    'location' => VALID_NOT_EMPTY,
    'email' => VALID_EMAIL
  );
and having error: undefined constant VALID_NOT_EMPTY

how can I change for CAKE 1.3 ???

thanks 


--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 



--
Chetan Varshney
Director
Ektanjali Softwares Pvt Ltd
Delhi India
Mobile: 91 9891538749 | Email: chetanv...@gmail.com | Skype: chetan-varshney
EktaSoftwares.Com

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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 cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: