![]() |
|
Snippets |
|
You can pass aditional parameters to input_auto_complete_tag helper. By default, autocompleter pass only object-referer value. For aditional parameter you need use 'with' in $completion_options array. in view layer:
< <?php echo object_input_tag($model, 'getFilter', array ('size' => 20, 'control_name' => 'filter',));?> ?php echo input_auto_complete_tag('field_to_search','','module/autocomplete', array('autocomplete'=>'off'),array('use_style'=>true,'with'=> " value+'&filter='+$('filter').value"))?>
you must put '" value' (with whitespace) because javascript fail (a little symfony bug). Aditional parameters must go after value.
in control layer:
public function executeAutocomplete(){ $search=$this->getRequestParameter('field_to_search'); $filter=$this->getRequestParameter('filter'); .... }
now you can use field_to_search and filter to construct any query in model layer ans show this in AutocompleteSuccess.php view or another view that you define. this was tested in synfony version > 0.9. Check your version, and review your javascripthelper helper to verify if your input_auto_complete_tag helper supports 'with' option