Preventing a menu item from being pressed twice 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.
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: