Advertisement
Guest User

Untitled

a guest
Jan 9th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1.    public function search() {
  2.         $this->Outlet->set($this->data);
  3.        
  4.         // define a custom validation for this form, we don't want to use the same validation rules as we do when we save outlet
  5.         $validate = array(
  6.             'postcode' => array(
  7.                 'rule' => array(
  8.                     'postal', null, 'uk'
  9.                 ),
  10.                 'allowEmpty' => true
  11.             )
  12.         ); 
  13.         $this->Outlet->validate = $validate;
  14.        
  15.         // validation message div display flag
  16.         $show_validation_msg = false;
  17.         // flag to toggle form display 
  18.         $display_form = true;
  19.         if ($this->Outlet->validates()) {
  20.             $this->Prg->commonProcess();
  21.  
  22.             // set flag
  23.             if(!empty($this->passedArgs)){
  24.                 $display_form = false;
  25.             }
  26.            
  27.             $this->paginate = array(
  28.                 'conditions' => $this->Outlet->parseCriteria($this->passedArgs),
  29.                 'limit' => 5
  30.             ); // max number of results to display per page
  31.         }else{
  32.             $show_validation_msg = true;
  33.         }
  34.        
  35.         $this->set('show_validation_msg', $show_validation_msg);
  36.         $this->set('outlets', $this->paginate());
  37.         $this->set('display_form', $display_form);
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement