Is there any way your auto-submit feature could include per-keypress submission for the search terms filter text field? See http://drupalmodules.com for what this would ideally look like - The site author explains a bit further here: http://drupal.org/node/234470.

Comments

infojunkie’s picture

Thanks for the suggestion. I'll look at it when time permits. Feel free to contribute a patch!

ManyNancy’s picture

This would be seriously quite wonderous.

obrienmd’s picture

Don't have the skill to do this myself, but would be interested in sponsoring a dev who does :)

scotjam’s picture

Component: User interface » General

Appreciate this feature request is four months old, but does anyone know if this is the only viable path to achieving this type of functionality, or does anyone know of an alternative route?

dgastudio’s picture

hi.

u can try this code in views_filters.autosubmit.js

/*
 * jQuery Timer Plugin
 * http://www.evanbot.com/article/jquery-timer-plugin/23
 *
 * @version      1.0
 * @copyright    2009 Evan Byrne (http://www.evanbot.com)
 */ 

jQuery.timer = function(time,func,callback){
	var a = {timer:setTimeout(func,time),callback:null}
	if(typeof(callback) == 'function'){a.callback = callback;}
	return a;
};

jQuery.clearTimer = function(a){
	clearTimeout(a.timer);
	if(typeof(a.callback) == 'function'){a.callback();};
	return this;
};



// $Id: views_filters_autosubmit.js,v 1.1.2.3 2010/07/03 16:53:27 kratib Exp $
(function ($) {
// START jQuery

Drupal.vfas = Drupal.vfas || {};

Drupal.behaviors.vfas = function(context) {
  $('form#'+Drupal.settings.vfas.form_id+':not(.vfas-processed)', context).each(function() {
    var self = this;
    var exceptions = Drupal.settings.vfas.exceptions;
	var myTimer = {};
    if (exceptions) {
      exceptions = ':not('+Drupal.settings.vfas.exceptions+')';
    }    
    else {
      exceptions = '';
    }
    $(self).addClass('vfas-processed');
    $('#'+Drupal.settings.vfas.submit_id, self).hide();

    $('div.views-exposed-widget input'+exceptions, self).bind('keyup', function() {
      myTimer = $.timer(1000,function(){
			$(self).submit();
	   	})  
	  });	
    $('div.views-exposed-widget select'+exceptions, self).change(function() {
      $(self).submit();
    });
  });
}

// END jQuery
})(jQuery);


is working, but with some problems. check it by yourself.

dgastudio’s picture

after inspect code in viewslivefilters, i make few changes in this code:

now is 100% working

// $Id: views_filters_autosubmit.js,v 1.1.2.3 2010/07/03 16:53:27 kratib Exp $
(function ($) {
// START jQuery

Drupal.vfas = Drupal.vfas || {};

Drupal.behaviors.vfas = function(context) {
  $('form#'+Drupal.settings.vfas.form_id+':not(.vfas-processed)', context).each(function() {
    var timeout = undefined;
    var delay = 1000;
    var self = this;

    var exceptions = Drupal.settings.vfas.exceptions;
    if (exceptions) {
      exceptions = ':not('+Drupal.settings.vfas.exceptions+')';
    }    
    else {
      exceptions = '';
    }
    $(self).addClass('vfas-processed');
    $('#'+Drupal.settings.vfas.submit_id, self).hide();
    $('div.views-exposed-widget input'+exceptions, self).bind('keyup', function() {	  
	  if (timeout) {
        clearTimeout(timeout);
      }
      var elem = this;
    	timeout = setTimeout(function() {
    	  timeout = undefined;
    	  $(self).submit();
    	}, delay);	  
    });	
    $('div.views-exposed-widget select'+exceptions, self).change(function() {
      $(self).submit();
    });
  });
}

// END jQuery
})(jQuery);

this code have little problem. After form submit, the focus on input is loosed.

any suggestion?

P.D. Sorry for my english.

infojunkie’s picture

Thanks! I'll take a look at this when I can. Anyone else who wants to try it and comment is welcome.

scotjam’s picture

First impressions are... it works! thank you :)

I'm not clued up on js to help out with the loss of input focus, but happy to be a tester, if it helps.

cheers
scotjam

eme’s picture

Submitting.

infojunkie’s picture

Status: Active » Needs work

Thanks for the submission.

In order for me to consider this code, it needs the following:

* Package as a patch against the latest dev.
* Ability to specify the per-keypress functionality per view - along with the other auto-submit settings.