Using jQuery it is quite effective to disable a button after the first click and show a spinner to indicate that the application is processing the request.
For those interested, let me summarize:
1) Get an image file for the spinner you like to use and save to radicore/css/ folder. Attached is the image I used (spin-red.svg).
2) Download jQuery file from https://jquery.com/download/ and save to radicore/javascript/ folder. Attached is the jQuery file I used (jquery-3.1.1.min.js).
3) For each module that you would like to implement this solution for, add the following to the module's style_custom.css file:
.loadingspinner
{
background:
url("../css/spin-red.svg")
no-repeat
center center;
}
4) Add the following to the *.class.inc files of the tables you need this solution for (Also check you have fixed http:// radicore.org/fud/index.php?t=msg&th=2299&start=0& ;)
function _cm_setJavaScript ($javascript)
// insert any javascript to be included in the <HEAD> or <BODY> elements.
{
$javascript['head'][]['file'] = '../javascript/jquery-3.1.1.min.js';
$javascript['foot'][]['code'] = "
$('form :submit').click(
function () {
\$(this).
addClass('loadingspinner').
prop('disabled', true).
closest('form').
append(\$('<input/>', {
type: 'hidden',
name: this.name,
value: this.value
})).
submit();
}
);";
return $javascript;
} // _cm_setJavaScript
That's all, enjoy!
References:
http:// stackoverflow.com/questions/22509343/prevent-double-form-sub mission
http:// stackoverflow.com/questions/12837335/how-to-display-loading- spinner-in-a-textbox-on-clicking-of-a-button