I'm using the Better Exposed Filters module to manipulate the filters in my view. It works great except for one issue that's affecting the whole layout.

Within my view I have four exposed filters out one is a Search (Search Terms). The auto submit works perfectly with the checkboxes filter but makes the search unusable. It basically submits it on every keypress and that hinders writing the complete word.

Is it possible, that I could have autosubmit on all filters except one (Search Terms filter)?

4 Answers 4


The auto-submit feature is a part of the Views module. It relies on the auto-submit CTools behavior. This plugin disables auto-submit for form elements that have the CSS class ctools-auto-submit-exclude. You can embed this JavaScript within the form header to disable auto submission on text fields.

jQuery(document).ready(function() {
  jQuery('div.views-exposed-form input[type="text"]').addClass('ctools-auto-submit-exclude');

You can adjust your jQuery selector accordingly for other form elements.

  • Thanks a lot Shawn, I added this JQuery which changed the input to this:- <input title="Enter the terms you wish to search for." type="text" id="edit-keys" name="keys" value="china" size="15" maxlength="128" class="form-text ctools-auto-submit-processed ctools-auto-submit-exclude" placeholder="Keyword">. Unfortunately, it still didn't work and is still submitting the form.
    – user219492
    Commented Aug 31, 2015 at 22:23
  • The JS triggering this is under the CTools module as js/auto-submit.js. You can set breakpoints on the code to see why/why not it's triggering submission on text field change.
    – Shawn Conn
    Commented Aug 31, 2015 at 22:34
  • The JS, for some reason didn't work. I had to create a module. See below.
    – user219492
    Commented Aug 31, 2015 at 23:50
  • Thanks. The solution above probably depends on when the JS is triggered. Your solution is probably the better option since it adds the class before any JS is fired.
    – Shawn Conn
    Commented Sep 1, 2015 at 0:43
  • You are absolutely correct. That was precisely the case.
    – user219492
    Commented Sep 1, 2015 at 20:20

The documentation in CTools suggests adding the class ctools-auto-submit-exclude in the element #attributes key for the form element you don't want to processed:

function MODULE_search_submission_form_alter(&$form, &$form_state, $form_id) {    
  if ($form_id == "views_exposed_form") {
    if (isset($form['keys'])) {
      $form['keys']['#attributes']['class'][] = 'ctools-auto-submit-exclude';

Below code will exclude the autocomplete in Drupal 8.

$form['keys']['#attributes'] = ['data-bef-auto-submit-exclude' => '']; 

For Drupal 8 better exposed use data attribute to exclude an item :

$form['keys']['#attributes']['data-bef-auto-submit-exclude'] = '';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.