In my add view when i kept all the fields blank and click on submit button it will display a message record added successfully instead of that i wan't to display my validation message and page should not be redirect to other page how to do this here is my add function code --------------------------------------------add function in controller--------------------------------------------------- function add(){ $this->set('sections', $this->Entry->Section->find('list',array ('fields'=>'Section.section','Section.id'))); if (!empty($this->data)){ $this->Entry->save($this->data); $id=mysql_insert_id(); if($id){ $query=mysql_query("select max(counter) from entries"); $row=mysql_fetch_array($query); $co=$row[0]+1; $q=mysql_query("update entries set counter=$co where id=$id"); if(is_uploaded_file($this->data['Entry']['File']['tmp_name'])){ $fileData = fread(fopen($this->data['Entry']['File']['tmp_name'], "r"), $this->data['Entry']['File']['size']); $fname = $this->data['Entry']['File']['name']; $ftype = $this->data['Entry']['File']['type']; $fsize = $this->data['Entry']['File']['size']; $fdata = addslashes($fileData); $q1=mysql_query("update entries set name='$fname',size= $fsize,type='$ftype',data='$fdata' where id=$id"); } } $this->Session->setFlash('The Entry has been saved'); $this->redirect('/entries/index'); } } -------------------------------------------------my model code is --------------------------------------------- <?php class Entry extends AppModel{ var $name = 'Entry'; var $belongsTo=array('Section'=>array( 'className'=>'Section' ), 'Submenu'=>array('className'=>'Submenu') ); var $validate = array( 'username' => array('/^[a-zA-Z._0-9]+$/'), 'Please enter username' => array('rule'=>'notEmpty'), 'Listitem'=>array( 'Please enter listitem' => array ('rule'=>'notEmpty')), 'section_id'=>array( 'Please select listitem' => array ('rule'=>'notEmpty')), 'Telephone'=>array( 'Please enter phone number' => array ('rule'=>'notEmpty'), 'Must be at least 10 chars' => array('rule'=>array ('minLength', 10))),
); } ?> please tell me the answer it is very urgent --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---