This is freelesson module code for validation.but its not working

====== freelesson.php===========

class FreeLesson extends AppModel
{
    var $name = 'FreeLesson';
        var $validate = array(
                'free_lesson_title' => array(
                        array('allowEmpty' => false, 'message' => 'Your Error 
Message'
                ),
                'free_lesson_description'=>array(
                        array('allowEmpty' => false, 'message' => 'Your Error 
Message')
                ),
        );

}

=======freelessons.php=============

freelessons Class Controller code

function admin_add_free_lesson()
        {
                $this->layout='admin_dashboard';
                $this->set('valid', true);
                //$this->session_check();
                if (!empty($this->data))
                {
                         $fileOK = $this->uploadFiles('upload\freelessons', 
$this->data
['FreeLessons']['free_lesson_name']);
                         if($fileOK)
                         {
                                 $this->data['FreeLessons']['free_lesson_name'] 
= $this->data
['FreeLessons']['free_lesson_name']['name'];
                                 if ($this->FreeLessons->save($this->data))
                                 {
                                        $this->Session->setFlash('Your lesson 
data has been saved.');
                                        $this->redirect(array('action' => 
'../admins/dashboard'));
                                 }
                         }
                }
        }

If i am provide all data record has been saved,but when ever fields
are empty it will not display
any error message.
Please correct me........

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to