Monday, September 8, 2014

Disable Custom button after clicked by Javascript

After clicking of a custom button on detail page lay-out, Chances is there to click the same button. 

If your button Behavior is "Execute JavaScript",
Add following code to disable the clicked button when it is performing certain action calls.

Sample Java Script Code:

this.className = "btnDisabled";
this.setAttribute("disabled","");


After getting the response from action methods you can enable it again. 

Sunday, September 7, 2014

Display standard button for specific profile without controller in List View

Visual Force Code:


<apex:page standardController="Order__c" tabstyle="Order__c">
 <apex:outputpanel id="panel" rendered="{!$Profile.name != 'System Administrator'}">
     <style>
         input.btn[name="new"] {
                display: none;
         }
     </style>
 </apex:outputpanel>
<div id="lblProfileId"></div>
 <apex:listViews type="Order__c"/>

</apex:page>

Saturday, September 6, 2014

How to remove the standard button loading on the custom VF page

Method 1 - Add below CSS class:


        input.btn[name="edit"] {  // removes the Edit button
            display: none;
        }
        input.btn[name="convert"] { // removes the convert button
            display: none;
        }
        input.btn[name="del"] {
            display: none;
        }
        input.btn[name="clone"] {
            display: none;
        }       
        input.btn[name="dupes"] {
            display: none;

        }

Method 2 - Add below JS function:

        window.onload = function toggleButtons() {
            window.document.getElementsByName('offline')[0].style.display = 'none';
        }

Friday, September 5, 2014

Open a standard edit page without header , footer and sidebar

After the button is clicked to display a pop-up window,  the window renders a standard page Url. Requirement is to render the standard page without header and side-bar. 

Use this java script statement at window opner.

Java Script: 

window.open('/{!detailSubjectID}/e?isdtp=vw&retURL={!detailSubjectID}','','width=900,height=650');


{!detailSubjectID} is used to return the url after the button click function of “save” “cancel

The parameter "isdtp=vw" on URL render the page without header and side-bar