Hi
I think your problem is here in your view :
> <?php echo $ajax->autoComplete('Post/title' ,'/myapps/blog/posts/
> autoComplete');?>
The url you use looks absolute, whereas it should be, as with all Cake
helpers, relative to your app (probably : "/blog/posts/autoComplete")
You should probably remove "echo "in the loop"; as well...
By the way, creating your form will be easier with the form helper:
"<?php $form->create("/posts/autoComplete") ?>"
And last, but not least, for all ajax debugging, I advise you to
install Firebug (https://addons.mozilla.org/fr/firefox/addon/1843)
It would have very quickly pointed you to the fact that your ajax
request was returning a 404, and not the page you wanted.
++++++
Clément
On Tue, Jun 10, 2008 at 5:50 PM, MMatchan <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Im brand new to Cake and to PHP in general. Im trying to setup a
> simple Ajax Autocomplete script going.. I have a DB table called Posts
> with a bunch of names called Title.
> I just want to have a simple textbox that autocompletes and fills in
> the selected title...
>
> Im using CAKE PHP v 1.2 . My probem is that the textbox renders
> correctly but the AJAX part is not working.... What am I missing ? Pls
> help
>
> Here is a snippet from my controller (posts_controller.php)
>
> function autoComplete()
> {
> echo 'in the loop';
> //$this->set('posts',$this->Post->findAll("title LIKE '{$this-
>>data['Post']['title']}'"));
> $this->set('posts', $this->Post->findAll());
> $this->layout = 'ajax';
> }
>
>
> Here is a snippet from my view (view.thtml)
>
> <form action="myapps/blog/posts/autoComplete" method="POST">
> <?php echo $ajax->autoComplete('Post/title' ,'/myapps/blog/posts/
> autoComplete');?>
> </form>
>
>
> Here is a snippet from my view (auto_complete.thml)
> <ul>
> <?php foreach($posts as $post): ?>
> <li>
> <?php echo $post['Post']['title']; ?>
> </li>
> <?php endforeach; ?>
> </ul>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---