When you select a suggested keyword the search should start automatically!!!

drupalina - March 27, 2009 - 04:32
Project:Keyword Autocomplete
Version:6.x-1.0-beta1
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

Hi,

this is a great module. Thanks a lot! (BZW, I've just switched from Search Autocomplete).

I'm not sure if this is a Bug-report or a Feature-request. Here it is:

Right now while I type a search keword several suggestions will pop out, and when I select one of those suggestions (with a mouse or the Enter button), nothing happens!!! This is disorienting and unintuitive, especially for the theme's search boxes that do not feature the "Search button". What I would suggest is that once one of the autocompleted suggestions is selected the search should start instantly! Check out how it is done on www.Wikipedia.org or www.YouTube.com or www.Facebook.com and many other sites where such functionality exists -- the search process starts as soon as one of the suggestions is selected!

Because of the standard set by those major sites, people are already accustomed to expect the search process to start as soon as one of the keywords is selected.

#1

midkemia - April 15, 2009 - 09:18

I too would like to see this feature. The number of times i have used my own site and done the same thing is countless.

#2

drupalina - April 25, 2009 - 15:14

Also ... www.Google.com has recently introduced this functionality and with exactly the same process as I described it above, so there you have it. I guess this is a web *standard* of how search autocomplete should behave.

#3

Dane Powell - October 1, 2009 - 15:33
Version:5.x-1.0» 5.x-1.x-dev

I agree this would be nice to see...

#4

Dane Powell - November 22, 2009 - 15:40

It could be that this simply isn't possible given Drupal's implementation of autocomplete. There is currently a discussion about enhancing autocomplete but I don't know that this has come up: #125231: Enhance autocomplete feature

#5

Dane Powell - November 22, 2009 - 15:48

Having said that we should be able to make it work with a little bit of JS trickery- api.drupal.org manages to do it with the following snippet:

Drupal.behaviors.apiAutoComplete = function (context) {
  $('#api-search-form:not(.apiAutoCompleteProcessed)', context).addClass('apiAutoCompleteProcessed').each(function () {
    // On the first focus.
    $('#edit-search', this).attr('autocomplete', 'off').one('focus', function () {
      var $this = $(this);
      // Prefetch list of objects for this branch.
      $.getJSON(Drupal.settings.apiAutoCompletePath, function (data) {
        // Attach to autocomplete.
        $this.autocomplete(data, {
          sort: function (a, b) {
            return a.value.length - b.value.length;
          },
          matchContains: true,
          max: 200,
          scroll: true,
          scrollHeight: 360,
          width: 300
        }).result(function () {
          $this.get(0).form.submit();
        }).focus();
      });
    });
  });
};

I am no JS guru however, so someone else might need to take the lead on this if you want it done soon.

#6

smoothify - November 26, 2009 - 01:55
Version:5.x-1.x-dev» 6.x-1.0-beta1
Status:active» needs work

I needed this functionality too, so to get it done quickly I borrowed some code from the finder_autocomplete module.

I have attached a patch for the drupal 6 version which seems to work for me so far.

AttachmentSize
keyword_autosubmit.patch 11.6 KB
 
 

Drupal is a registered trademark of Dries Buytaert.