Well I am working on a visualforce page which has several sections with their own fields. The sections should be independent from each other. Now in one section I've got two operations: add and cancel. When I press the Add button I want that only the fields from its section are processed by the server.

However, when I press the Cancel button I don't need to process the section's field - just cancel. It means when cancelling I don't care if the required fields are populated. For this I am certainly need to cover the Cancel button within the apex:actionRegion element.

Here is a part of my code:


    <apex:form id="recipients">

        <!-- other code is skipped for brevity -->

        <!-- New recepient section -->
            <apex:pageBlock id="addNewRecipient"
                            rendered="{! addNewRecipientVisible }">
                <apex:pageBlockButtons location="bottom">
                    <apex:commandButton value="Add"
                                        action="{! addRecipient }"

                        <apex:commandButton value="Cancel"
                                            action="{! hideAddRecipient }"

                <apex:pageBlockSection columns="1"
                                       title="New recipient">

                    <apex:inputField id="recipientLanguage"
                                    value="{! recipient.Language__c }"/>




Notice that there are 2 apex:actionRegion elements which are nested. I ran the code and it worked, but I would like to know if putting apex:actionRegion in another apex:actionRegion is a good practice and it does not have any implications.

  • Well, when I click on the Cancel button it hides the whole "addNewRecipient" page block. That's why I need rerender on the button.
    – Eduard
    Nov 28, 2018 at 12:50
  • Thank you @SantanuBoral. That works for me - one actionRegion
    – Eduard
    Nov 28, 2018 at 13:00
  • I have added as answer Nov 28, 2018 at 13:12

1 Answer 1


I think cancel button within actionRegion is not needed if you don't need to process anything to the server and rerender specific portion. I would prefer not to use nested actionRegion.

Then outer actionRegion is fine for that, no need to use that for cancel.

You must log in to answer this question.

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