Loading indicators for non-AJAX form buttons
AJAX forms in Drupal show a progress indicator while they work. This module does the same for ordinary form submissions: the button shows that the form is submitting, and a second submit is blocked until the page loads.
Three indicator types:
- A spinner on the button
- Drupal's AJAX throbber next to the button
- Drupal's AJAX fullscreen progress indicator
Configuration
- Install and enable the module
- Visit Admin / Config / User Interface / Submit Indicator
- Choose your default indicator type (spinner, throbber, or fullscreen)
- Done - every non-AJAX form now shows feedback on submit
You can also set the indicator per form or per button.
For every setting and theming option, see the README.md.
Features
- Three indicator types: a spinner on the button, Drupal's throbber next to the button, or Drupal's fullscreen progress indicator
- Automatic or opt-in: every form by default, or only the forms you list
- Form API property:
#submit_indicatorsets the indicator per form and per button (similar to#ajax) - Exclusions: AJAX forms are skipped automatically; admin pages, form IDs (with wildcards), and anything with the exclusion class can be left out
- Theme-friendly: the "disabled" look uses the theme's own disabled button style (Drupal's
is-disabledclass), with a gray default; spinner color and image are set with CSS custom properties - Accessible: buttons are marked
aria-disabledwithout leaving the submitted data, and the spinner slows down for users who prefer reduced motion - Client-side validation: the indicator resets when the browser's validation or Clientside Validation stops the submit
How it works
When a user submits a non-AJAX form:
- The configured indicator (spinner, throbber, or fullscreen) is shown
- A second submit, from any button or the Enter key, is blocked
- The form's submit buttons are optionally marked as disabled
- If client-side validation fails, the indicator resets immediately
- If the form submits, the page loads and the indicator is gone, also when the user comes back with the browser's Back button
- A configurable timeout resets the indicator if the page doesn't load
A script that cancels the submit to do its own work first, such as getting a payment token, resets the indicator on an error by dispatching one event:
form.dispatchEvent(new CustomEvent('submit-indicator-reset'));Usage: #submit_indicator property
// Use the fullscreen indicator for a form
$form['#submit_indicator'] = ['type' => 'fullscreen'];
// Shorthand - just pass the type
$form['#submit_indicator'] = 'throbber';
// Disable for a specific button
$form['actions']['preview']['#submit_indicator'] = FALSE;
// Disable for the entire form
$form['#submit_indicator'] = FALSE;
// Spinner with custom color
$form['actions']['submit']['#submit_indicator'] = [
'type' => 'spinner',
'color' => '#000000',
];
Available options
type- 'spinner', 'throbber', or 'fullscreen'color- Spinner color; empty uses the button's text color (spinner only)position- 'end', 'start', or 'center' (spinner only)room- Widen the button's padding for the spinner (spinner only)text- Text on the button while the form submitslook- 'button' or 'disabled'message- Text shown next to the throbber (throbber only)disableButton- Mark the submit buttons as disabled while the form submits (default: true)
Similar modules
- Page Load Progress - Locks the screen with a throbber when a form is submitted.
- Hide Submit - Hides or disables submit buttons.
Requirements
- Drupal 10.1 or later, 11, or 12
Project information
4 sites report using this module
- Created by loze on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.
Releases
1.0.0-alpha2
released 29 November 2026
Works with Drupal: ^10.1 || ^11 || ^12
Install:
Development version: 1.0.x-dev updated 3 Dec 2026 at 07:47 UTC

