How to alter textfield auto-submit delay? I have a view with exposed filters using AJAX and auto-submit feature.

The problem is it reacts too fast, submitting the request after every key up very fast, so that the view is reloaded before users could finish to type search text... 

I would like instead to choose how many millisec it waits before sending request...
I tried different ways to do that, this working one was suggested by Andy in comments to a close but different issue, thanks to him !

In fact CTools autosubmit has a hardcoded delay on submitting fixed to 500ms.

A possible way is to switch auto-submit.js to your own modified copy. However if you do this, you'll need to check if auto-submit.js has changed every time you do an upgrade to CTools. :

function neptune_js_alter(&amp;$javascript) {
  if ($some_condition) {
    $new_autosubmit = drupal_get_path('theme', 'YOUR_THEME') . '/js/auto-submit.js';
    $javascript['profiles/commons/modules/contrib/ctools/js/auto-submit.js'] = drupal_js_defaults($new_autosubmit);
  }
}


And set your value into auto-submit.js :

//Lines 87 and following
    var timer = 3000;
          .keyup(function(e) {
            if ($.inArray(e.keyCode, discardKeyCode) === -1) {
              timeoutID = setTimeout($.proxy(triggerSubmit, this.form), timer);
            }
          })
          .bind('change', function (e) {
            if ($.inArray(e.keyCode, discardKeyCode) === -1) {
              timeoutID = setTimeout($.proxy(triggerSubmit, this.form), timer);
            }
          });


To be more flexible you may want to add an attribute to the input you need to change :

function MODULE_form_MYFORM_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['MY_INPUT']['#attributes'] = array('class' =&gt; array('ctools-auto-submit-delayed'));
}


And then change value for this class only

    var timeoutID = 0;
    var timer = 500;
    if ($(this).hasClass('ctools-auto-submit-delayed')) {
      timer = 3000;
    }
    $(this)
      .bind('keydown keyup', function (e) {
        if ($.inArray(e.keyCode, discardKeyCode) === -1) {
          timeoutID &amp;&amp; clearTimeout(timeoutID);
        }
      })
      .keyup(function(e) {
        if ($.inArray(e.keyCode, discardKeyCode) === -1) {
          timeoutID = setTimeout($.proxy(triggerSubmit, this.form), timer);
        }
      })
      .bind('change', function (e) {
        if ($.inArray(e.keyCode, discardKeyCode) === -1) {
          timeoutID = setTimeout($.proxy(triggerSubmit, this.form), timer);
        }
      });


This would be more elegant &amp; flexible to pass directly the timer value to js, but I have no time to think more about it.

PS : there is an existing patch about that issue but it returns errors in my config.