Pages

Sunday, September 15, 2013

Cakephp-Data Validation Not Working-Resolution workflow

Recently while working on a Linux Machine I faced an issue where cake's default validation was not working.Here is the walkthrough of steps which you must ensure to make it work if it still doesn't let me know

1. First things first-If you are working on linux server File Name Casing is an issue.Make sure your model File name,Class name matches the name of your first parameter in form.


 //File name  
 Task.php  
 //Model Class  
 class Task extends AppModel  
 {  
 }  
 //Form Start  
 <?php echo $this->Form->create('Task');?>  

2. Check Validation rule's format they should match cake convention's

     public $validate = array(
        'title'=>array(
            'alphaNumeric' => array(
                'rule'     => 'alphaNumeric',
                'required' => true,
                'message'  => 'Alphanumeric only'
            ))); 

I was doing everything right but my file name was incorrect I was using a lowercase filename which caused the error

No comments:

Post a Comment