0

I have a menu item that shows up on one of my nodes and when pressed it will trigger a somewhat long process. I would like to make it so that the user is not tempted to press the menu button again but I can't quite figure out how to do that. Is there a good way to put an overlay over the Drupal window to explain that the process will take some time and prevent another click? If not, would it be possible to show an alert dialog from the menu callback, warning the user this will take some time.

2
  • Is your menu using Drupal's AJAX? Commented Apr 3, 2015 at 5:10
  • If you want to use AJAX, Drupal already adds the progress-disabled class so I guess the link is covered already. You can try the Chaos Tools AJAX Demo module. Commented Apr 3, 2015 at 5:38

2 Answers 2

1

For long tasks you should use Drupal's Batch API. It takes a bit to learn, but has these benefits.

  • The user will be taken to a separate page with a progress bar.
  • You can display a custom message explaining what you are doing.
  • If you can break your task into discrete chunks that can be performed in separate requests that will ensure that you won't run into any php timeout issues and the users will see their progress.

For example, during Drupal setup you see the following batch process:

progress bar during Drupal install.

0

This module is matching your requirement https://www.drupal.org/project/jquery_loadinganimation.

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.