title: Model Validation in CakePHP
body: <p>i have some problems with the validation rules.</p>
  
  <p><strong>UPDATED :</strong></p>
  
  <blockquote>
    <p>Warning (512): Could not find validation handler maxLength for lastname [CORE\Cake\Model\Validator\CakeValidationRule.php, line 281]</p>
    
    <p>Warning (512): Could not find validation handler maxLength for firstname [CORE\Cake\Model\Validator\CakeValidationRule.php, line 281]</p>
    
    <p>Warning (512): Could not find validation handler maxLength for phone [CORE\Cake\Model\Validator\CakeValidationRule.php, line 281]</p>
    
    <p>Warning (512): Could not find validation handler maxLength for address [CORE\Cake\Model\Validator\CakeValidationRule.php, line 281]</p>
    
    <p>Warning (512): Could not find validation handler maxLength for zipcode [CORE\Cake\Model\Validator\CakeValidationRule.php, line 281]</p>
    
    <p>Warning (512): Could not find validation handler maxLength for city [CORE\Cake\Model\Validator\CakeValidationRule.php, line 281]</p>
    
    <p>Warning (512): Could not find validation handler maxLength for birth [CORE\Cake\Model\Validator\CakeValidationRule.php, line 281]</p>
  </blockquote>
  
  <pre><code>public $validate = array(
      'username' =&gt; array(
          'alphanumeric' =&gt; array(
              'rule' =&gt; array('alphanumeric'),
              'allowEmpty' =&gt; false,
              'required' =&gt; true,
              'message' =&gt; "Alphanumeric characters only.",
          ),
          'between' =&gt; array(
              'rule' =&gt; array('between',4,20),
              'message' =&gt; "The username must be between %d and %d characters.",
          ),
          'isUnique' =&gt; array(
              'rule' =&gt; 'isUnique',
              'message' =&gt; "This username is already taken.",
          ),
      ),
      'password' =&gt; array(
          'notEmpty' =&gt; array(
              'rule' =&gt; array('notEmpty'),
              'message' =&gt; "You must specify your password.",
          ),
      ),
      'passwordconfirm' =&gt; array(
          'between' =&gt; array(
              'rule' =&gt; array('between', 8, 20),
              'required' =&gt; true,
              'message' =&gt; "The password must be between %d and %d characters.",
          ),
          'equalTo' =&gt; array(
              'rule' =&gt; array('equalToField', 'password'),
              'message' =&gt; "Passwords are not identical.",
          )
      ),
      'oldpassword' =&gt; array(
          'notEmpty' =&gt; array(
              'rule' =&gt; array('notEmpty'),
              'required' =&gt; true,
              'message' =&gt; "You must specify your old password.",
              'on' =&gt; 'update',
          ),
      ),
      'lastname' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 25),
              'required' =&gt; true,
              'message' =&gt; "Your last name can't contain more than %d characters.",
          ),
      ),
      'firstname' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 25),
              'required' =&gt; true,
              'message' =&gt; "Your first name can't contain more than %d characters.",
          ),
      ),
      'mail' =&gt; array(
          'email' =&gt; array(
              'rule' =&gt; array('email'),
              'required' =&gt; true,
              'message' =&gt; "You must specify a valid Email address.",
          ),
          'isUnique' =&gt; array(
              'rule' =&gt; 'isUnique',
              'message' =&gt; "This Email is already taken.",
          ),
      ),
      'user_type' =&gt; array(
          'inList' =&gt; array(
              'rule' =&gt; array('inList', array('particular','professional','association')),
              'required' =&gt; false,
              'message'   =&gt; "Your choice is not valid.",
          ),
      ),
      'denomination' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 150),
              'message' =&gt; "Your company name can't contain more than %d characters.",
              'on' =&gt; 'update',
          ),
      ),
      'siret' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 45),
              'message' =&gt; "Your company registration number can't contain more than %d characters.",
              'on' =&gt; 'update',
          ),
      ),
      'phone' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 20),
              'message' =&gt; "Your phone number can't contain more than %d characters.",
              'on' =&gt; 'update',
          ),
      ),
      'address' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 255),
              'message' =&gt; "Your email address can't contain more than %d characters.",
              'on' =&gt; 'update',
          ),
      ),
      'zipcode' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 15),
              'message' =&gt; "Your zip code can't contain more than %d characters.",
              'on' =&gt; 'update',
          ),
      ),
      'city' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 150),
              'message' =&gt; "Your city can't contain more than %d characters.",
              'on' =&gt; 'update',
          ),
      ),
      'birth' =&gt; array(
          'maxLength' =&gt; array(
              'rule' =&gt; array('maxLength', 10),
              'message' =&gt; '%d characters maximum for your date of birth.',
              'allowEmpty' =&gt; true,
          ),
      ),
  );
  </code></pre>
  
  <p>And some times, i have this error too : (if it can help)</p>
  
  <pre><code>Fatal Error
  Error: Call to undefined method Validation::getDataSource() 
  File: Z:\wamp\www\gc2\lib\Cake\Model\Datasource\DboSource.php   
  Line: 1062
  
  Notice: If you want to customize this error message, create app\View\Errors\fatal_error.ctp
  </code></pre>
  
  <p>Version of CakePHP : 2.4.3
  (Sorry for my bad english, i'm french ^^)</p>