Hi all,
I'm trying to get my autocomplete working in cake 1.2. I have the
autocomplete setup and working properly.
>From Controller
====================
function autocomplete()
{
$this->layout = 'ajax';
if(empty($this->params['data']))
{
echo "empty";
}
else
{
$this->set('ingredients',$this->Ingredient->findAll("name LIKE '%
{$this->data['Ingredients']['name']}%'"));
}
}
>From View
====================
<h1>Add Your Drink</h1>
<?php echo $form->create('Drink', array('action' => 'add', 'class' =>
'mainform'));?>
<fieldset>
<legend>Required</legend>
<?php echo $form->label('Drink.name', 'Name Your Drink'); ?>
<?php echo $form->input('Drink.name', array('size' => '50',
'maxlength' => '70')); ?><br>
<?php echo $form->label('Ingredients.name', 'Ingredients'); ?>
<?php echo $ajax->autocomplete('Ingredients.name', '/ingredients/
autocomplete', array()); ?>
</fieldset>
<?php echo $form->submit('Add', array('id' => 'submit1')); ?>
<?php echo $form->end(); ?>
that works fine, but what I'm trying to do is have items selected from
an autocomplete added to a list in an ajax div. And after those items
are added to a list I'd like to have them saved to the database. I
have a HABTM relationship between a drinks table and an ingredients
table. I'm also a little confused about what goes on behind the
scenes with HABTM models as well. If anyone can enlighten me on this
at all I'll give you free beer!
I've been around the web researching this for about an hour but cake
1.2 documentation is more limited than 1.1 and I'm an ajax newbie.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---