1

I have three page block section in a pageblock of the visualforce page. I am using standard controller with extension. I need to add standard save/cancel buttons to first section alone. I can use a different page block for the next two sections. But i want all the sections in one page block and the buttons only to the first section.

Please let me know how to keep the buttons specific to each section.

Code:

<apex:page standardController="xxx" extensions="xxxExtension" id="page">
<apex:form>
    <apex:pageBlock id="pb">
        <apex:pageBlockSection title="General Information" collapsible="true" columns="2" id="pbs"> 
            input and output fields 
        </apex:pageBlockSection> 

        <!-- I want the buttons within this section  -->
        <apex:pageBlockSection title="Related Events" collapsible="true">
        </apex:pageBlockSection>

        <apex:pageBlockSection title="Other Information" collapsible="true">
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>
2
  • Post your code please Commented Mar 10, 2015 at 9:27
  • My code is below <apex:page standardController="xxx" extensions="xxxExtension" id="page"> <apex:pageBlock id="pb"> <apex:pageBlockSection title="General Information" collapsible="true" columns="2" id="pbs"> input and output fields </apex:pageBlockSection> // I want the buttons within this section <apex:pageBlockSection title="Related Events" collapsible="true"> </apex:pageBlockSection> <apex:pageBlockSection title="Other Information" collapsible="true"> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page> Commented Mar 10, 2015 at 9:56

1 Answer 1

3

How about to use a apex:pageBlockSectionItem. You can "group" element with that tag:

    <apex:pageBlockSection title="Related Events" collapsible="true" >
        <apex:pageBlockSectionItem>
            <apex:outputPanel layout="none">
                <apex:commandButton value="Edit" />
                <apex:commandButton value="Save" />
                <apex:commandButton value="Cancel" />
            </apex:outputPanel>
        </apex:pageBlockSectionItem>
    </apex:pageBlockSection>

Result:

enter image description here

2
  • Yes that can be used. But it does not allow more than two components. In my case i need to add three buttons. Edit, Save and Cancel Commented Mar 10, 2015 at 10:56
  • 1
    @SFDCLearner Not really correct. You can put multiple elements into the apex:outputPanel. I've updated my answer. Commented Mar 10, 2015 at 11:07

You must log in to answer this question.

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