*Solved it!*

I can't seem to debug($this->data), so I debug($this->params);

And found the solution.

$this->params['form']['q'];

Instead of

$this->data['q']

Which is not working.

Regards,
--
Louie Miranda
 - Email: lmira...@gmail.com
 - Web: http://www.louiemiranda.com



On Wed, Aug 4, 2010 at 11:04 AM, Louie Miranda <lmira...@gmail.com> wrote:

> I tried the ajax autocomplete manual.
> http://book.cakephp.org/it/view/1370/autoComplete
>
> *PROBLEM:*
>
>    1. I can't seem to query $this->data['q'];
>    2. Therefore, the auto complete list shows, everything. And not the
>    specific keyword or "q" value.
>
> How will I query $this->data['q'];? I think, I followed everything. What
> seems to be wrong?
>
> The codes:
>
> *Added my controller*
>
> function autocompletetitle() {
>>     $this->set('results', $this->Publication->find('all', array(
>>             'conditions' => array(
>>                 'Publication.itemName LIKE' => $this->data['q'].'%'
>>                 ),
>>             'fields' => array('itemName')
>>                 )));
>>     $this->layout = 'ajax';
>> }
>>
>
>
> *And my form*
>
> <?php echo $form->create('Publication', array('action' => 'sresults',
>> 'type' => 'get'));?>
>> <?php echo $ajax->autoComplete('q', '/publications/autocompletetitle'); ?>
>> <?php echo $form->end('Search'); ?>
>>
>
> The autocompletetitle view is set and working, I can see it when accessing
> /autocompletetitle and if I search.
>
> --
> Louie Miranda
>  - Email: lmira...@gmail.com
>  - Web: http://www.louiemiranda.com
>
>

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