On 3/16/07, fredBH <[EMAIL PROTECTED]> wrote:
>
> can you post the code ?

Sure, here is the sutocomplete.thtml file.  It returns the username
and then the full name in brackets
<ul>
<?php foreach($users as $user): ?>
<li><?php echo $user['User']['username'].' ('.$user['User']['fname'].'
'.$user['User']['lname'].')'; ?></li>
<?php endforeach; ?>
</ul>

The form is in send.thtml

<form action="<?php echo $html->url('/messages/send'); ?>" method="post">
<?php echo $ajax->autocomplete('Message/user',
'/Messages/autocomplete', array('size' => 40)); ?>

<?php echo $html->textarea('Message/message', array('cols' => '60',
'rows' => '10')); ?>
<div class="submit">
        <?php echo $html->submit('Send');?>
</div>
</form>

And the autocomplete function from the messages controller:
function autocomplete() {
    $this->set('users', $this->User->findAll(array('User.username' =>
'LIKE '.$this->data['Message']['user'].'%'), array('User.username',
'User.fname', 'User.lname', 'User.id'), 'username DESC',null, null,
0));
    $this->layout = "ajax";
}

So the function returns the User.id but I cant see how to pass that to
the view and back again.

Mike.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to