Community Documentation

Patching Drupal core (misc/autocomplete.js)

Last updated November 29, 2012. Created by pkiraly on October 8, 2012.
Log in to edit this page.

There is an issue in the search box with autocompletion. If the user hit enter at the end of a search term, the expected behaviour would be to start searching. However if the search box is connected to an autocompletion feature, the enter only hides the autocomplete popup, and only the second enter starts the searching. This is a Drupal core behaviour, and since it is not something we can override with the help of the hook system (it is JavaScript functionality), we provided a patch against Drupal core, namely the file misc/autocomplete.js. You can apply the patch with

git apply sites/all/modules/xc/xc_util/patches/xc-autocomplete.patch

or

patch -p1 < sites/all/modules/xc/xc_util/patches/xc-autocomplete.patch

You can find more info about applying patches at Drupal's Patch guide (http://drupal.org/patch/apply) or in case of problems the following page: http://drupal.org/node/1129120.

The patch will change the misc/autocomplete.js file a little bit. The most important change is that instead of the original

}).size() == 0;

you will see

  }); // }).size() == 0;
  return 1;

around line 29.

AttachmentSize
xc-autocomplete.patch866 bytes

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x
Audience
Site administrators
Level
Intermediate
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.