title: Cake php Model Validation Not Working
body: <p>I want insert record in a table.For this i have model,view and controller.Everything in my code is working perfectly but my model code for validation not showing any validation message.What should i do?I am giving below the code :</p>
  
  <p>My Controller Code : </p>
  
  <pre><code>    public function send_money()
          {
  
           $this-&gt;layout='agent';
           $this-&gt;Agent-&gt;create();
           $this-&gt;Agent-&gt;set($this-&gt;data);
  
             if(empty($this-&gt;data) == false)
              {
                  //$this-&gt;Agent-&gt;saveAll($this-&gt;data['Agent'], array('validate' =&gt; 'only')); //This code Id New
                  $this-&gt;Agent-&gt;saveAll($this-&gt;data['Agent']);
                  $this-&gt;Session-&gt;setFlash('Information Added Successfully.');
                  $this-&gt;redirect('send_money');
  
              }
              else
              {
                  $this-&gt;set('errors', $this-&gt;Agent-&gt;invalidFields());    
              }
  
          }
  
  And My Model Code is :
  
  
  
      App::uses('AppModel', 'Model');
      /**
       * Admin Login Model
       *
       */
       class Agent extends AppModel
       {
          public $name='Agent';
          public $usetables='agents';
  
          public $validate = array(
  
           'contact' =&gt;array(
            'rule' =&gt; 'notEmpty', // or: array('ruleName', 'param1', 'param2' ...)
            'allowEmpty' =&gt; false,
            'message'    =&gt; 'Please Enter Contact No.'
          ),
           'name' =&gt;array(
            'rule' =&gt; 'notEmpty', // or: array('ruleName', 'param1', 'param2' ...)
            'allowEmpty' =&gt; false,
            'message'    =&gt; 'Please Enter Name.'
          ),
  
           'email_add' =&gt;array(
            'rule' =&gt; 'email', // or: array('ruleName', 'param1', 'param2' ...)
            'allowEmpty' =&gt; false,
            'message'    =&gt; 'Please Enter Valid Email.'
          ),
          );
  
       }
  </code></pre>