I'm having a bit of difficulty getting Cake to recognize any Ajax
functionality.  My most recent attempt is to make a simple autocomplete
box following Nate's example as seen at
http://cakebaker.wordpress.com/2006/06/06/autocompletion-the-easy-way/

I included the helper and the component in the top of my controller
class

<?php
class OrganizationController extends AppController
{
   var $components = array('Autocomplete');
   var $helpers = array('Ajax','Javascript','Html');

To be doubly sure, I also tried including the helpers variable
definition directly into the app_controller too.

Then in my view I have a simple

<div>
<p>Autocomplete a leader's name: </p>
<?php echo $ajax->autocomplete('organization_leader/name'); ?>
</div>

I've tried loading the js libraries several ways.  The way I'm doing it
now is simply putting the following directly into my default.thtml

<script src="/js/prototype.js" type="text/javascript"></script>
<script src="/js/scriptaculous.js" type="text/javascript"></script>



When I go to the page, I get no js errors.  Everything seems to render
normally, but there is no ajax functionality.

I may be missing something but the final product seems to be fairly
correct.
I see:

<head>
<title>Organization leaders</title>
<script src="/js/prototype.js" type="text/javascript"></script>
<script src="/js/scriptaculous.js" type="text/javascript"></script>

...

<div id="content">
                <div><p>Autocomplete a leader's name: </p>
<input name="data[organization_leader][name]"
id="organization_leader_name" autocomplete="off" value="" type="text"
/><div  id="organization_leader_name_autoComplete"
class="auto_complete"></div><script type="text/javascript">new
Ajax.Autocompleter('organization_leader_name',
'organization_leader_name_autoComplete',
'/organization_leader/practice/30', {asynchronous:true,
evalScripts:true});</script></div>
</div>


I don't know if t is relavant or not, but the fact that the input field
says autocomplete="off" kinda concerns me.

I'm looking for advice on more things to check, since I can't figure
out why it is silently failing on me.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to