I would like to alter an exposed view filter (of a node title) so it becomes an autocomplete. In my module I have something like the following code:

function my_module_form_views_exposed_form_alter(&$form, $form_state) {
  if(isset($form_state['view']->name) && $form_state['view']->name == 'some_form') {
    $form['title']['#autocomplete_path'] = 'path/to/custom/autocomplete';
  }
}

This does not seem to be doing anything. The ['#autocomplete_path] attribute is present in the $form array. I looked at how the views handler for taxonomy attaches autocomplete and it seemed to be attaching #autocomplete_path to a textfield too. Any documentation on how to go about this would be much appreciated.

Comments

DrupOn’s picture

subbed

This happens even when you try to override the #autocomplete_path of a term or node reference field in hook_form_alter.

dawehner’s picture

You could look directly in form api whether the #autocomplete_path comes to the fapi or not.

Everything behind fapi is not something views can fix. It's an api which just can be used.

ngmaloney’s picture

Status: Active » Closed (works as designed)

Thanks @dereine and @DrupOn. I mistakenly thought #autocomplete_path would work as I expected in FAPI. I'll be sure to share the solution.