Hi,
i am trying to deal with the apache solr auto complete version as i upgraded it to 6.x-1.2. Firebug shows jquery error as its unable to detect jquery.autocomplete function
the error is '$(".apachesolr-autocomplete.unprocessed", context).autocomplete is not a function ::[Break On This Error] formatItem: function(item) { '
please help me its urgent.

Comments

janusman’s picture

Try clearing caches; if you're aggregating JS that might be the issue. If you keep having problems siwtch to the legacy "Drupal Core Autocomplete" widget at admin/settings/apachesolr under "Advanced options". See the README.txt for more.

saifthe1’s picture

Thank you for your help..
I even tried calling the jquery autocomplete js file with core js includes, then changed the sequence of include in the module file and even tried delay timer to call the function though still not detecting autosuggest function. However i switched to legacy auto suggest but isn't there any solution for the problem.

janusman’s picture

Other things to try:
- switch off JS aggregation at admin/build/performance
- disable other modules that add JS to your pages (maybe one is in conflict with the new Autocomplete widget)

janusman’s picture

Status: Active » Postponed (maintainer needs more info)

Waiting for more feedback. You're the only one reporting this so I need more data to go on (I really suspect it's a collision with another module). It'd be awesome if you alse specify if yo uhave jQuery Update or other modules that add/change jQuery plugins installed.

Bill Choy’s picture

Issue summary: View changes

I know this is a old issue.... but here is the solution for 6.x-1.4.

apachesolr_autocomplete_init() bring in the Javascripts in the wrong order. The jQuery_autocomplete JS needs to be included before the module's JS file.

.......

apachesolr_autocomplete.js uses the JQuery $ variable before it has been defined by jquery-autocomplete.js [with the standard "function($) {....})(jQuery);" ]

So if we change


function apachesolr_autocomplete_init() {
  drupal_add_css( drupal_get_path('module', 'apachesolr_autocomplete') . '/apachesolr_autocomplete.css');

  // If using custom JS widget, include files and settings.
  if (apachesolr_autocomplete_variable_get_widget() == 'custom') {
    // Add custom autocomplete files
    drupal_add_js(drupal_get_path('module', 'apachesolr_autocomplete') .'/apachesolr_autocomplete.js');
    drupal_add_js(drupal_get_path('module', 'apachesolr_autocomplete') .'/jquery-autocomplete/jquery.autocomplete.js');
    drupal_add_css( drupal_get_path('module', 'apachesolr_autocomplete') .'/jquery-autocomplete/jquery.autocomplete.css');
    // Specify path to autocomplete handler.
    drupal_add_js(array('apachesolr_autocomplete' => array('path' => url('apachesolr_autocomplete'))), 'setting');
  }
}

to

function apachesolr_autocomplete_init() {
  drupal_add_css( drupal_get_path('module', 'apachesolr_autocomplete') . '/apachesolr_autocomplete.css');

  // If using custom JS widget, include files and settings.
  if (apachesolr_autocomplete_variable_get_widget() == 'custom') {
    // Add custom autocomplete files
    drupal_add_css( drupal_get_path('module', 'apachesolr_autocomplete') .'/jquery-autocomplete/jquery.autocomplete.css');
    drupal_add_js(drupal_get_path('module', 'apachesolr_autocomplete') .'/jquery-autocomplete/jquery.autocomplete.js');
    drupal_add_js(drupal_get_path('module', 'apachesolr_autocomplete') .'/apachesolr_autocomplete.js');
    // Specify path to autocomplete handler.
    drupal_add_js(array('apachesolr_autocomplete' => array('path' => url('apachesolr_autocomplete'))), 'setting');
  }
}

Everything should work. Or you can stop using the 'Autocomplete widget to use: Custom autocomplete widget' in /admin/settings/apachesolr under "Advanced configuration".

see my patch in https://www.drupal.org/node/2446059