You need to sign in to do that
Don't have an account?
shashi kanaparthi
Diasbling a on click javascript button after submission
Hi,
i have a button on quotes, the button needs to be disabled after the user clicks once. Let me know if this can be done with JavaScript itself rather than create a VF page.
Code Below :-
{!RequireScript("/soap/ajax/33.0/connection.js")}
var sync = '{!Quote.IsSyncing }'
var conversion = '{!Quote.Conversion_Status__c}'
if( sync == false)
{
alert("Please sync your quote before continuing");
}
else if( conversion == 'Sent')
{
alert("Your Quote has already been sent to CW");
}
else
{
var r = confirm("Note that you can only send Quote to CW one time. Are you sure you want to send?");
}
if(r==true)
{
var quoteID = '{!Quote.Id}'
postParams = {}
postParams.url = 'https://servicesuat.restorationhardware.com:10000/QuoteToCW/' + quoteID
postParams.method = 'GET'
postParams.requestHeaders = {}
postParams.requestData = ''
postParams.requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded' //or another mime-type
postParams.requestHeaders['Content-Length'] = postParams.requestData.length //required for POST
postParams.onSuccess = processSuccess
postParams.onError = processError
sforce.connection.remoteFunction(postParams)
function processSuccess(message)
{ // do something with results¨
alert(message);
window.location.reload();
}
function processError(message)
{ // do something with the error
alert('error');
}}
i have a button on quotes, the button needs to be disabled after the user clicks once. Let me know if this can be done with JavaScript itself rather than create a VF page.
Code Below :-
{!RequireScript("/soap/ajax/33.0/connection.js")}
var sync = '{!Quote.IsSyncing }'
var conversion = '{!Quote.Conversion_Status__c}'
if( sync == false)
{
alert("Please sync your quote before continuing");
}
else if( conversion == 'Sent')
{
alert("Your Quote has already been sent to CW");
}
else
{
var r = confirm("Note that you can only send Quote to CW one time. Are you sure you want to send?");
}
if(r==true)
{
var quoteID = '{!Quote.Id}'
postParams = {}
postParams.url = 'https://servicesuat.restorationhardware.com:10000/QuoteToCW/' + quoteID
postParams.method = 'GET'
postParams.requestHeaders = {}
postParams.requestData = ''
postParams.requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded' //or another mime-type
postParams.requestHeaders['Content-Length'] = postParams.requestData.length //required for POST
postParams.onSuccess = processSuccess
postParams.onError = processError
sforce.connection.remoteFunction(postParams)
function processSuccess(message)
{ // do something with results¨
alert(message);
window.location.reload();
}
function processError(message)
{ // do something with the error
alert('error');
}}
You can not disable it without using a visualforce page. Only thing that you could do is to update a field in Database on first click and query the field from Data Base before doing any further action and show a message to user.
Thanks
Shashikant
All Answers
You can not disable it without using a visualforce page. Only thing that you could do is to update a field in Database on first click and query the field from Data Base before doing any further action and show a message to user.
Thanks
Shashikant
You can place this.disabled = true after requirescript statement. By doing so, it will be disabled when the button is clicked, but this will reverted to the enabled state once the user refreshes the page. To refrain the user from subsequent clicks, you can follow the aforementioned approach.
Thanks,
Pankaj