Implementing download button need to be disable on click and re-enable after download
Application Type
Traditional Web
Service Studio Version
11.12.1 (Build 49734)

Hi all,

I am implementing a download button which will need to be disabled on click and re-enable after completion of downloading. 

I have tried different methods/plugins from forge but not able to get the button re-enabled.

The closest method I have tried is using javascript code below but re-enable after 5 sec. 

var e=this;   

setTimeout(function(){e.disabled=true;},0);   

setTimeout(function(){e.disabled=false;},5000);   

return true;

If possible, I would need it to re-enable only after download have completed.  

Please help. :)

Why javascript, can you not use a local variable where you put at true when you are downloading and false when you are not. And on the button on the property Enabled you put that the button is enabled when that local variable is not true. In this way, you will not be able to click again when the action to download starts.

This is just me thinking, let me know what you think

Kind regards,

Márcio

I have tried local variable but it is not possible too. I believe it is due to those are server action and it does not set the local variable after the last download action completed.

Following is the action flow:

First assignment for IsDownloading = True

Second assignment for IsDownloading = False

Properties of Download button:

Result: No feedback and button is not disabled at all


I understand!! Give it a try on @Tousif khan. In this case with the variable you cannot control when the download has finished

Hi, What I think on this we can do is  to disable the download button for Sometime between 1- 2 minutes by using timers to  prevent users clicking the button again immediately while the file downloads - it's the least work, but depend on  download speeds,

Regard,

Tousif

Guess so... Thanks for the confirmation. 

Hi Nicksgg,

If you are unable to enable or disable the download button, I would suggest you to show a spinner when the user clicks on download button and make it invisible  when the download is completed. This can restrict the user from clicking download button again or elsewhere in the screen and also will give them an indication that download process is taking place.

Thanks & Regards,

Diyab

Hi Diyab, Thanks for the suggestion. 

It is having the same issue to enable or disable of download button. We are unable to capture when the download is completed. Without that, we are unable to make the spinner to be invisible. The user will be stuck on the spinner. 

I have tried AntiSpamButton from forge too but not successful for Download action. 

Hi Diyab,

I think your suggestion is similar to using local variable to disable the button (can use loading button also). 

However, it's not the issue I think.

The issue here is how do we know the download is completed...

Cheers,

Khuong

Champion

Hi nicksgg,

in my case, I created a new web screen and download the file in the screen preparation. You can define the destination to go back your original screen at the end of your screen preparation.

Hope it helps.

Cheers

Ronny

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.