In my autocomplete_controller() i use the function
function getData(){
$this->layout = 'ajax';
$this->set("typed",$this->data['Autocomplete']['AutocompleteName']);
for($i=0;$i<10;$i++){
$items[] = rand(1,100);
}
$this->set("items",$items);
}
it will show the random numbers 1 to 100 in autocompletion text field
when i type any letter. Anybody can give me the code to access the
data from a table. I expect the query. Help me plz.!
I add the related files here!
// get_data.ctp
<ul>
<li><?php echo $typed;?></li>
<?php foreach($items as $item): ?>
<li><?php echo $item; ?></li>
<?php endforeach; ?>
</ul>
//index.ctp
<?php
echo $html->charset("UTF-8");
$javascript->link("prototype",false);
$javascript->link("scriptaculous",false);
$html->css("cake.ajax");
?>
<div class="customers form">
<?php echo $form->create('Autocomplete');?>
<fieldset>
<legend><?php __('Autocomplete');?></legend>
<?php
echo $ajax->autocomplete('AutocompleteName',"getData",array());
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---