Friday, February 22, 2013

autocomplete issue in cake 1.3

hi guys,... can someone help please,... I have a autocomplete issue in cake 1.3 
I'm using jquery helper from http://www.cakephp.4uk.pl/ajax/autoComplete 
I manage to see the results in form field, 

this is my search.ctp file: 

<div style="float: left; width: 400px; margin: 10px 0 40px 15px; ">

<?php echo $this->Form->create('User', array('action' => 'search')); ?>
<?php echo $this->Form->text('firstname', array('style' => 'width: 60px')) ?>&nbsp;

<?php echo $this->Form->text('User.email', array('style' => 'width: 60px')) ?>&nbsp;

<?php echo $this->Form->text('User.city', array('style' => 'width: 60px')) ?>&nbsp;
<?php echo $this->Form->end(__('Search', true)); ?>
</div>

<?php foreach($users as $user_obj): ?>
  <div>
  <?php echo $html->link($profileShow->buddy($user_obj), '/profile/' . $user_obj['User']['username'], array('escape'=>false)) ?>
  <.div>
<?php endforeach ?>

this is auto_complete.ctp 

    <?php foreach($members as $member): ?>
<?php echo $member['User']['firstname'] . '|' . $member['User']['lastname'] . "\n" ?>
    <?php endforeach; ?>



this is my controller functions: 

function autoComplete() {

    $this->set('members', $this->User->find('all', array(
                'conditions' => array(
            'OR' => array( 
                    'User.firstname LIKE' => $this->params['url']['q'].'%', 
                    'User.lastname LIKE' => $this->params['url']['q'].'%'
                )),
                'fields' => array('firstname', 'lastname')
    )));
    $this->layout = 'ajax';
}

  function search() 
  {
$this->User->recursive = 0;
$this->set('users', $this->paginate());

  }

I can see ALL users with pagination in that page, but not the user that I search... 
Please help,... 

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+unsubscribe@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.
 
 

No comments: