+ Start a Discussion
Tavva Sai KrishnaTavva Sai Krishna 

Disable custom button which is on detail page.

I have a custom button on detail page of account object whose behaviour is "Execute Javascript" and content source is "onclick JavaScript". My query is how can i disable the button upon click on it.
I have tried with below code but no luck
{!REQUIRESCRIPT("https://code.jquery.com/jquery-3.0.0.min.js")}
$(this).addClass( 'btnDisabled' );

Also I tried with the prop, and attr methods instead of addClass. does any one has got same error!!!

Thanks and Regards,
Sai Krishna Tavva.
Best Answer chosen by Tavva Sai Krishna
Intraxtech IncIntraxtech Inc
Hi,
The below script may help you if your content soure is "Onclick Javascript"
var a=document.getElementsByName('test')[0];
a.className='btnDisabled';
a.value='Processing..';
For the button labelled 'Test' in standard page: ( check button name in page source as below )
<input value=" Test "  class="btn" name="test" title="Test" type="button" onclick="....
Since Salesforce already disables button for the styleclass 'btnDisabled' on standard detail page.

All Answers

Intraxtech IncIntraxtech Inc
Hi,
The below script may help you if your content soure is "Onclick Javascript"
var a=document.getElementsByName('test')[0];
a.className='btnDisabled';
a.value='Processing..';
For the button labelled 'Test' in standard page: ( check button name in page source as below )
<input value=" Test "  class="btn" name="test" title="Test" type="button" onclick="....
Since Salesforce already disables button for the styleclass 'btnDisabled' on standard detail page.
This was selected as the best answer
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Try this
var a=document.getElementsByName('disable_me');
a.className='btnDisabled';
a.onclick='';