hi guys,... can anyone help please,... I'm using cake 1.3 I have a autoComplete form where I want to search and filter/results members by 'firstname', 'lastname', and 'city',... It only works with 'firstname' : e.g.
here is the form: <?php echo $this->Form->create('User', array('url' => '/search', 'id' => 'PageID')); ?> <?php echo $this->Ajax->autoComplete('User.name', '/users/autoComplete', array('label' => false)); ?> <?php echo $this->Form->submit('magnifier.png'); ?> <?php echo $this->Form->end(); ?> here is auto_complete.ctp: <?php foreach($members as $member): ?> <?php echo $member['User']['firstname'] . "\n" ?> <?php endforeach; ?> and controller functions: function autoComplete() { $this->set('members', $this->User->find('all', array( 'conditions' => array('User.token IS NULL', 'OR' => array( 'User.firstname LIKE' => $this->params['url']['q'].'%', 'User.lastname LIKE' => $this->params['url']['q'].'%', 'User.city LIKE' => $this->params['url']['q'].'%' )), 'limit' => $this->params['url']['limit'], 'fields' => array('firstname', 'lastname', 'city') ))); $this->layout = 'ajax'; } function search() { ............. ............. $this->paginate = array('User' => array('conditions' => array('User.token IS NULL', 'User.firstname LIKE'=>'%'.$this->data['User']['name'].'%'))); ............ ............ } HOWEVER when I add $member['User']['lastname'] . ' ' . $member['User']['city'] in auto_complete.ctp <?php foreach($members as $member): ?> <?php echo $member['User']['firstname'] . ' ' . $member['User']['lastname'] . ' ' . $member['User']['city'] . "\n" ?> <?php endforeach; ?> I can NOT filter results in function search(),... here is what I have already tried: function search() { ................... ................... // $this->paginate = array('User' => array('conditions' => array('User.token IS NULL', 'fields' => array('User.firstname LIKE'=>$this->data['User']['name'].'%', 'User.lastname LIKE'=>$this->data['User']['name'].'%', 'User.city LIKE'=>$this->data['User']['name'].'%') ))); // $this->paginate = array('User' => array('conditions' => array('User.token IS NULL', 'User.firstname LIKE'=>$this->data['User']['name'].'%', 'fields' => array('firstname', 'lastname', 'city') ))); // $this->paginate = array('User' => array('conditions' => array('User.token IS NULL', 'OR' => array('User.firstname LIKE' => $this->data['User']['name'].'%', 'User.lastname LIKE' => $this->data['User']['name'].'%', 'User.city LIKE' => $this->data['User']['name'].'%') ))); // $this->paginate = array('User' => array('conditions' => array('User.token IS NULL', 'User.firstname LIKE'=>'%'.$this->data['User']['name'].'%', 'User.lastname LIKE'=>'%'.$this->data['User']['name'].'%', 'User.city LIKE'=>'%'.$this->data['User']['name'].'%'))); ................ ................ } how can I do this please,...? thanks in advance chris -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.