My Autocomplete is failing, but I can not see what the problem is.
_________Aan Controller_________
class AansController extends AppController {
var $name = 'Aans';
var $uses = array('Aan','Student');
var $scaffold;
var $helpers = array('Html', 'Javascript', 'Ajax');
function add(){
$this->layout = 'forms';
$this->set('students',$this->Student->findAll());
$this->pageTitle = 'DIFR | Approved Absence Notification |
Cashman
Middle School';
if (!empty($this->data)) {
if ($this->Aan->save($this->data['Aans'])) {
$this->redirect('aans/review/'.$this->Aan->getLastInsertId());
}
}
}
}
_________Student Controller_________
class StudentsController extends AppController {
var $name = 'Students';
var $helpers = array('Html', 'Javascript', 'Ajax');
var $scaffold;
function autocomplete(){
$this->set('students',$this->Student->findAll("last_name LIKE
'{$this->data['Student']['last_name']}'"));
$this->layout = "ajax";
}
}
_________Add View_________
<style type="text/css">
div.auto_complete {
position :absolute;
width :250px;
background-color :white;
border :1px solid #888;
margin :0px;
padding :0px;
}
li.selected {
background-color: #ffb;
}
</style>
<? echo $html->formTag(); ?>
<p>Autocomplete Last Name:<? echo
$ajax->autoComplete('Student/last_name',
'/students/autocomplete')?></p>
</form>
I have uploaded the Scriptaculous and prototype library to webroot/js/
and my ajax layout looks like
<? echo $javascript->link('prototype') ?>
<? echo $javascript->link('scriptaculous') ?>
I don't know what I am missing, but it is not working. Any help would
be great.
Thanks,
Garth
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---