+ Start a Discussion
dcarmen66dcarmen66 

In pageBlockButtons, <apex:facet> only works with top set of buttons

I have functionality in a form so when the users click on the button, the button goes disabled. The only problem I have is that in a <apex:pageBlockButtons> block, where two sets of buttons are created, only the top set of buttons becomes disabled. This was put into place to prevent the users from double-clicking the buttons, however they end up double-clicking the lower set of buttons because those buttons do not become disabled.

 

         <apex:pageBlockButtons id="productButtons">
            <apex:actionStatus rendered="{!NOT(readOnly)}" id="applyButtonStatus">
               <apex:facet name="stop">
                  <apex:commandButton id="applyButtonActive" action="{!calcRevenue}" value="Apply Changes/Calculate Revenue" status="applyButtonStatus" disabled="false" rerender="productTypeSelectionBlock"/>
               </apex:facet>
               <apex:facet name="start">
                  <apex:commandButton id="applyButtonDisabled" action="{!calcRevenue}" value="Applying Changes..." status="applyButtonStatus" disabled="true" rerender="productTypeSelectionBlock"/>
               </apex:facet>
            </apex:actionStatus>
         </apex:pageBlockButtons>

 

Is there any way to get this to work inside of the pageBlockButtons block, or do I just have to create two sets of buttons? If I create two sets, then they'll disable independently of each other, which isn't ideal.

notThatShanenotThatShane

I'm having a similar problem.  Has anyone come across this?

 

Here's the code:

 

<apex:outputPanel id="mainBody">	
    <apex:pageBlock title="Selected {!$ObjectType.Product2.LabelPlural}" id="theList">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!removeFromList}" value="Remove" immediate="false" status="removingStatus" rerender="theList, removingStatus" />
            <apex:commandButton action="{!onSave}" value="Save" immediate="false" status="savingStatus" rerender="savingStatus"/>
            <apex:commandButton action="{!cancel}" value="Cancel" immediate="true" onClick="if(!confirmCancel()) return false;"/>

            <apex:actionStatus id="removingStatus" startText="Please wait..." stopText=" " onStart="document.body.style.cursor = 'wait';return true;" onStop="document.body.style.cursor = 'default';return true;"/>
             <apex:actionStatus id="savingStatus" startText="Saving..." stopText=" " onStart="document.body.style.cursor = 'wait';return true;" onStop="document.body.style.cursor = 'default';return true;" />
         </apex:pageBlockButtons>    
    <apex:pageBlockTable value="{!lineItems}" var="li">
.
.
.
    </apex:pageBlockTable>
</apex:pageBlock>

 

marcobmarcob

Hi,

i have a VF page with a save button on top, and a save button at the bottom of the page. To disable one when the user clicks the other, i have created this solution, and it works.

 

For the top button:

     

<apex:pageblockbuttons location="top">

  <apex:actionStatus id="saveStatus1">

  <apex:facet name="stop">       

    <apex:commandButton onclick="checkDoubleSubmit(this);" action="{!saveall}" status="saveStatus2" value="Save" disabled="false" rerender="<your relevant pageblocks>"/>

  </apex:facet>    

  <apex:facet name="start"> 

    <apex:commandButton value="Save" disabled="true"/>

  </apex:facet>

</apex:actionStatus>       

 

and this for the bottom button:

     

<apex:pageblockbuttons location="bottom" id="pageblockbuttonsbottom">

  <apex:actionStatusid="saveStatus2">

    <apex:facetname="stop">   

      <apex:commandButton onclick="checkDoubleSubmit(this);" action="{!saveall}" status="saveStatus1" value="Opslaan" disabled="false" id="savebuttonbottom" rerender="<your relevant pageblocks>"/>

    </apex:facet>    

    <apex:facet name="start">

      <apex:commandButton value="Save" disabled="true"/>

    </apex:facet>

  </apex:actionStatus>       

 

I now face the challenge to add more buttons in the top and bottom sections. And i want this: if the user clicks one button, it should disable all buttons. Don't have the answer yet, but will work on it  the next couple of days.

 

C-u, Marco

mgodseymgodsey
Were you able to figure out how to disable all buttons when one is clicked? I'm trying to do the same thing and would really appreciate any tips, thanks!