function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ColinCColinC 

pageBlockButtons only work at the bottom of the page, not at the top

I've noticed that in some of my Visualforce pages the buttons in a pageBlockButtons only work at the bottom, and not the top.   The page goes away but returns unchanged and with the action not taken.   At the bottom the actions work perfectly, those at the top do nothing.

 

I have no Javascript in the page, and no errors appear from either the developer log or the code console.

 

Anyone else have this?   I'd put up the code, but it happens in about 10% of my pages, and I cannot see any common link.

 

 

Devendra@SFDCDevendra@SFDC

Hi Colin,

 

<apex:pageBlockButtons location="top/bottom/both">
                <apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>

 

Also refer to the below note,

 

The area of the page block where the buttons should be rendered. Possible values include "top", "bottom", or "both". If not specified, this value defaults to "both". Note that if a pageBlock header facet is defined, the facet overrides the buttons that would normally appear at the top of the page block. Likewise if a pageBlock footer facet is defined, the facet overrides the buttons that would normally appear at the bottom of the page block.

 

Hope this helps :)

 

Thanks,

Devendra

 

ColinCColinC

No, you misunderstand.  The buttons appear on the page.  But when clicked they do nothing.  We are, of course, using location="both".   No facets are used.

 

Devendra@SFDCDevendra@SFDC

Hi Colin,

 

Can you please paste your code? So that we can get idea about whats happening through the code.

 

Thanks,

Devendra

ArleneArlene

Did you ever find a solution to this?  It also happens on only some of my pages.  I can get around the problem by creating two identical pageBlockButtons, one with location="top" and one with location="bottom", but location="both" does not work, nor does omitting the location attribute.  With location="both", the buttons appear in both locations, but the top buttons do not work correctly.  They don't call the appropriate methods in the controller, and any immediate="true" is ignored.  This is only happening in newer pages, and I'm wondering what might have changed.   We have about 40 pages where the buttons work fine, but two pages which use the same template don't work unless we duplicate the button block.

 

Given this Controller:

  public with sharing class TestController {
      public TestController() {
    }
    public PageReference previousPage() {
       return new PageReference('/003e0000002lz3b');
    }
  }

 

The top buttons on this page work:

<apex:page Controller="TestController" showHeader="false" >
    <apex:composition template="MyHHT_TemplateLayout">
        <apex:define name="page_content">
            <apex:form id="claimEntryForm">
                <apex:pageBlock id="pbClaimEntry">
                    <apex:pageBlockButtons location="top">
                        <apex:commandButton value="Previous" action="{!previousPage}" styleClass="prevSubmit" immediate="true" />
                    </apex:pageBlockButtons>
                    <apex:pageBlockButtons location="bottom">
                        <apex:commandButton value="Previous" action="{!previousPage}" styleClass="prevSubmit" immediate="true" />
                    </apex:pageBlockButtons>
                </apex:pageBlock>
            </apex:form>
         </apex:define>
    </apex:composition>
</apex:page>

 

The top buttons on this page do not:

<apex:page Controller="TestController" showHeader="false" >
    <apex:composition template="MyHHT_TemplateLayout">
        <apex:define name="page_content">
            <apex:form id="claimEntryForm">
                <apex:pageBlock id="pbClaimEntry">
                    <apex:pageBlockButtons location="both">
                        <apex:commandButton value="Previous" action="{!previousPage}" styleClass="prevSubmit" immediate="true" />
                    </apex:pageBlockButtons>
                </apex:pageBlock>
            </apex:form>
         </apex:define>
    </apex:composition> 
</apex:page>

 

Even though the pages look identical to the user.    There is a lot going on with the template you can't see -- two components above and one below the page outlined here, as well as some Javascript.  But regardless of what is going on in the template, I would expect the behavior to be identical from page to page, and it is not.

vijaymindvijaymind
This is only because of apex:composition. Once you remove this tag this would work properly.
I am also facing the same issue.
ArleneArlene

We have the same apex:composition on all of our portal web pages.  It provides the header, footer, and menus.   On most of our pages, the buttons appear in both places.  On a handful of pages, the buttons will not appear in both places unless we code them twice.  We cannot remove the apex:composition tag, as it provides consistent content and look and feel for all of our pages.

 

What I don't understand is why some pages work, and others do not, when the apex:composition on all pages is the same.

vijaymindvijaymind

I have my other force.com site where I am also using apex:composition and both top and bottom buttons are working properly.

Let me check with other one I'll let you know the reason.

Egor VolkovEgor Volkov
Perhaps you have a problem with submit page. I had the similar issue, but then I added  <apex:pageMessages /> to the page and found the reason of problem.