function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NalinakuNalinaku 

Disable to button after first click for upto 4 hours

I have a button which executes the Javascript on the case objects. Basically what it does is it escalates the case. But the problem is user can click it repeatedly and cause lot of cases/alerts generated. 
We want to limit user to wait for atleast 4 hours after the first click. Here is the javascript behind this button. How can I add a counter of 4 hours to this. 
 
{!REQUIRESCRIPT('/soap/ajax/26.0/connection.js')}
{!REQUIRESCRIPT('/js/functions.js')}
{!REQUIRESCRIPT('resource/JQueryNew/jQuery/jquery-1.8.2.min.js')}
{!REQUIRESCRIPT('resource/JQueryNew/jQuery/ui/jquery-ui-1.9.1.custom.min.js')}
{!REQUIRESCRIPT('resource/JQueryNew/jQuery/postmessage/jquery.ba-postmessage.js')}
{!REQUIRESCRIPT('resource/JQueryNew/jQuery/bbq/jquery.ba-bbq.min.js')}
requireCssFile('resource/JQueryNew/jQuery/ui/css/ui-lightness/jquery-ui-1.9.1.custom.min.css');
function requireCssFile(filename)
{
var fileref = document.createElement('link');
fileref.setAttribute('rel', 'stylesheet');
fileref.setAttribute('type', 'text/css');
fileref.setAttribute('href', filename);
document.getElementsByTagName('head')[0].appendChild(fileref);
}
var j$ = jQuery.noConflict();
var iframe_url = '{!URLFOR("apex/CustomerEsc?id=")}{!Case.Id}';
var child_domain = iframe_url.substring(0, iframe_url.indexOf('/', 9));
var parent_domain = window.location.protocol + '//' + window.location.host;
var j$modalDialog = j$('<div id="opppopup"></div>')
.html('<iframe id="iframeContentId" src="' + iframe_url + '" frameborder="0" height="100%" width="100%" marginheight="0" marginwidth="0" scrolling="yes" />')
.dialog({
autoOpen: false,
title: 'Escalate Case',
resizable: true,
width: 850,
height: 605,
autoResize: true,
modal: true,
draggable: true
});

j$modalDialog.dialog('open');

//window.location.href="apex/CustomerEsc?id={!Case.Id}"

 
VinayVinay (Salesforce Developers) 
Hi,

Review below link that can help you.

https://stackoverflow.com/questions/10932766/disable-the-submit-button-after-clicking-and-enable-it-back-again-after-a-few-se

Thanks,
Vinay Kumar