How to add autocomplete filter to a views based on webform results? I have a views that lists webform results. There are some fields such as name, e-mail address, city etc comes from webform submission.
I want an exposed filter to filter the views based on city. This can be done and a search input appears at the top of the views but there is a problem: you should enter the full city name and then submit. There is no autocomplete or select list feature.
There is a module called Views Autocomplete Filters for this purpose but doesn't work with webform results data.
There was a sandbox project called Webform Selectable Filters before but doesn't exist now.
So, how to add an autocomplete exposed filter to a view that is based on webform results data?
I did this in my custom module :

function hook_form_alter( &amp;$form, &amp;$form_state,$form_id ) {

  if($form_id == 'views_exposed_form') {
    $view = $form_state['view'];
    if($view-&gt;name == 'your_view_name') {  
     $form['data']['#autocomplete_path'] = 'example/autocomplete';
   }
  }
}


'#autocomplete_path' => 'example/autocomplete' defines an autocomplete callback for our textfield. 

When user types something into our textfield, Drupal sends a request via this url to send data you input and to receive suggestions via json if there are any. 

To make Drupal aware of this path, let’s add it to the menu system(hook_menu):

$items['example/autocomplete'] = array(
  'page callback' =&gt; '_module_name_autocomplete',
  'access arguments' =&gt; array('access content'),
  'type' =&gt; MENU_CALLBACK
);


Now we need to create a _module_name_autocomplete function which will look for a suggestion and return it to the user.

function _module_name_autocomplete($string) {

  $matches = array();
  // Some fantasy DB table which holds cities
  $return = db_select('webform_submitted_data', 'w')
  -&gt;fields('w')
  -&gt;condition('w.cid', 'your_component_id', '=')
  -&gt;condition('w.data', '%' . db_like($string) . '%', 'LIKE')
  -&gt;execute();

  // add matches to $matches
  foreach ($return as $row) {
   $matches[$row-&gt;data] = check_plain($row-&gt;data);
  }

 // return for JS
 drupal_json_output($matches);
}