autocomplete funtionality to:
The form consists of:
1. A dropdown selector that allows you to select a city ("NYC", "LA",
"BOS" for example)
2. A search box.
I have autocomplete working fine under the normal configuration, but
the problem is that the autocomplete results are not restricted to the
selected city.
I cannot figure out how to pass the Search term AND the city value to
the autocomplete function.
Here is the relevant code:
[FROM VIEW]
<?php echo $form->input('Restaurant.metro', array('options' => array
('SEA', 'NYC', 'LA'), 'label' => '')); ?>
<?php echo $ajax->autoComplete('Restaurant.name', '/restaurants/
autoComplete')?>
[FROM CONTROLLER]
function autoComplete() {
$this->set('restaurants', $this->Restaurant->find('all', array(
'conditions' => array(
'Restaurant.name LIKE' => $this->data['Restaurant']['name'].'%',
//'Restaurant.metro LIKE' => $this->data['Restaurant']['metro']
<-- NEED TO GET data['Restaurant']['metro'] TO CONTROLLER AS WELL
),
'fields' => array('name'),
'limit' => 20
)));
$this->layout = 'ajax';
}
Any insight would be much appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment