I need a help in Autocomplete in cakephp.

My controller:

class AmaladdsController extends AppController {

        var $name = 'Amaladds';
        var $helpers = array('Html', 'Form', 'Javascript', 'Ajax', 'Layout');
..
...
.....
function autoComplete() {
        //Partial strings will come from the autocomplete field as
        //$this->data['Amaladd']['subject']
        $this->set('posts', $this->Amaladd->find('all', array(
                                'conditions' => array(
                                        'Amaladd.subject LIKE' => 
$this->data['Amaladd']['place'].'%'
                                ),
                                'fields' => array('place')
        )));
        $this->layout = 'ajax';
}


My view (auto_complete.ctp)

<ul>
 <?php foreach($posts as $post): ?>
     <li><?php echo $post['Amaladd']['place']; ?></li>
 <?php endforeach; ?>
</ul>


My form:

<?php echo $form->create('User', array('url' => '/users/index')); ?>
        <?php echo $ajax->autoComplete('Amaladd.subject', '/amaladds/
autoComplete')?>
<?php echo $form->end('View Post')?>

in my layout file i included:
print $javascript->link('prototype');
print $javascript->link('scriptaculous');
print $javascript->link('scriptaculous/src/effects');
print $javascript->link('scriptaculous/src/controls');


Everything is similar to the Manual. But It doesnot work. In the
generated script in Firebug it show this line after submitting the
form:

<form method="post" action="/amaladds/index">
<fieldset style="display:none;">
<input type="hidden" name="_method" value="POST" />
</fieldset>

<input name="data[Amaladd][place]" type="text" id="AmaladdPlace"
autocomplete="off" value="" />

<div id="AmaladdPlace_autoComplete" class="auto_complete"></div>
<script type="text/javascript">

//<![CDATA[
new Ajax.Autocompleter('AmaladdPlace', 'AmaladdPlace_autoComplete', '/
amaladds/index', {});
//]]>

</script><div class="submit"><input type="submit" value="View Post" /
></div></form>

What is wrong here??? when I type first 3 or more letters of the
'Place' field in my database, nothing happens.

Please help me....


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to