Hi Everyone,
What's the best approach to prevent users from spam clicking buttons when they think nothing is happening?
Thanks
use this button loading widget.
Hi JayPea,
Disable the button after first click. Use enable property of the button with Boolean variable.
Thanks,
Neha
@ibox that's interesting. Will this prevent spam clicking or is it just a visual indicator for the user that something is happening?
Do I need to use it in conjunction with enable button property?
I used this button to prevent user to double click... and so far so good, no need to disable the button.
If it is not enough, may be u can disable the button and enable only when she checks this:
regards
As ibox has mentioned, you can (and should) use the Button Loading block provided by OutSystems UI. This takes in a boolean to indicate it is loading and will show a loading indicator on the button and also prevent further clicks until the boolean has been unset.
Make sure to set the boolean to True before running the server action, set it to False once the server action is completed. Make sure you also set it to False if there is a Communication Exception.
When migrating from regular buttons to ButtonLoading, you will see a div with the class osui-btn-loading__spinner-animation. This is the loading indicator that will show, make sure you keep this div else you will receive an error message when the widget is rendered. Within the block, there is also the input ShowLabelOnLoading, by default OutSystemsUI will hide the text and only show the loading indicator but I recommend keeping the Label on load.
For my projects, I made another block that uses ButtonLoading, defaults ShowLabelOnLoading to True and also does not immediately show the loading indicator (to prevent a content flash).