I have used page block button in one page for save button so that I can have two save buttons at the top and buttom of the page.I have to disable the both the save button once clicked both at top and buttom of page.But, while clicking the button at the buttom, button present at the top of the page is not disabled and it allows the user to click it.I have already tried thejava script for this functionality also.But in both the cases only one button getting disabled.Appreciate any help!

<apex:pageBlockButtons >
      <apex:actionStatus id="saveStatus"> 
        <apex:facet name="stop">
            <apex:commandButton title="Save" value="Save" style="padding:2px 6px;" action="{!saveRecord}" accesskey="Enter" reRender="pgBlockMsgs" status="saveStatus" onclick="scroll()">
              <apex:param value="{!stringSave}" name="saveType" assignTo="{!saveType}" />
        <apex:facet name="start">
          <apex:outputPanel >
             <apex:image value="/img/loading32.gif" style="height: 20px;"/>
             <apex:commandButton value="Processing..." status="saveStatus" disabled="true"/>

1 Answer 1


Use a simple Javascript function for disabling buttons. Assign some extra css class to the pageBlock button and disable/enable only these buttons. If one of these buttons is clicked - disable the both. When the action is complete - enable both buttons again:

function blockReleaseBtns(disable){
    var btns = document.getElementsByClassName('saveBtnClass');
    for(var i = 0; i < btns.length; i++){
            btns[i].disabled = 'disabled';
            btns[i].className = 'saveBtnClass btnDisabled'; 
        else {
            btns[i].disabled = '';
            btns[i].className = 'saveBtnClass btn'; 


        <apex:commandButton value="Save" reRender="pgBlockMsgs" status="saveStatus"

        <apex:actionStatus id="saveStatus">
            <apex:facet name="start">
                 <apex:image value="/img/loading.gif" style="height:20px;"/>


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .