Tuesday, January 29, 2013

autoComplete with jquery in cake 1.3

hi guys,.. can you help me please,... 
I'm in cake 1.3 and using jquery libraries 

I got all setup, including jquery.autocomplete.min.js from Ajax Javascript helper http://www.cakephp.4uk.pl/ajax/autoComplete ,... 
I can see the "fistnames" in autocomplete form field, but I can't select them,... 

how can I fix this...? 

this is my form: 

<?php echo $this->Form->create('User'); ?>

<div style="float: left; width: 200px; margin: 10px 0 40px 15px; ">
<?php echo $ajax->autoComplete('User.firstname', '/users/autoComplete', array('label' => false)); ?>
</div>

<span style="float: left; width: 200px; margin: 5px 0 40px 15px; ">
<?php echo $this->Form->end(__('Search', true)); ?>
</span> 


this is my function: 

function autoComplete() {

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

and this is auto_complete.ctp file: 

<ul>
    <?php foreach($members as $member): ?>
     <li><?php echo $member['User']['firstname']; ?></li>

    <div class="clr"></div>
    <?php endforeach; ?>
</ul>

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: