Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Disable ajax throbber

Throbber is an element with a message that shows us that something is running in background. Drupal renders this element each time when ajax request is running (for example when you submit form via ajax). Sometimes we need to disable throbber at all or at least remove/change message. That's how you can do this.

Disable throbber at all:
<?php

// Add 'progress' settings into '#ajax'
// element of a submit button. Define progress
// type as 'none'.
$form['actions']['submit']['#ajax']['progress'] => [
  'type' => 'none',
];
Remove/change throbber message:
<?php

// Add 'progress' settings into '#ajax'
// element of a submit button. Change progress
// message to NULL (delete message) or any other
// string (change message).
$form['actions']['submit']['#ajax']['progress'] => [
  'message' => NULL,
];
If you  send ajax requests as described in this post you should modify settings variable and add progress property. Disable throbber:
var $link = $('#link-element', context);

new Drupal.ajax($link.attr('id'), $link, {
  url: '/ajax/callback/path',
  event: 'click',
  progress: {
    type: 'none'
  }
});
Remove/change throbber message:
var $link = $('#link-element', context);

new Drupal.ajax($link.attr('id'), $link, {
  url: '/ajax/callback/path',
  event: 'click',
  progress: {
    type: 'throbber',
    // Change progress message to NULL
    // (delete message) or any other
    // string (change message).
    message: null
  }
});

Key notes:

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web