0

I'm trying to call a simple function in my Apex Controller and want to use an actionRegion to stop most sections of the page re-rendering. I note though when I add the actionRegion the controller function does not get called. I'm sure I've come across a similar issue years ago but can't find the exact same scenario detailed anywhere.

Basically here is a simple example. As you can see i've tried but commandButton and commandLink. I was trying to assign a parameter also but noted that the function is not even being called. It does call it if I don't use the actionRegion.

 <apex:actionRegion>
    <apex:commandButton rerender="testRerender" value="Select Instances" 
                        action="{!nullPageReference}" styleClass="slds-button">
        <apex:param name="editMode" value="EDIT" assignTo="{!viewMode}"/>
    </apex:commandButton>

    <apex:commandLink action="{!nullPageReference}" reRender="testRerender" value="SelectorS">
       <!--<apex:param name="editMode" value="EDIT" assignTo="{!viewMode}"/>-->
    </apex:commandLink>
 </apex:actionRegion>


public PageReference nullPageReference() {
    System.debug('HelloCalledFunc');
    return null;
}

Does anyone know why this does not work and if so how I can workaround it to call the function while in an actionRegion.

Thanks in advance.

0

If you are using <apex:actionRegion> to stop certain sections of the page to rerender, I'm afraid it does not support that.

According to the documenation,

Note that an <apex:actionRegion> component only defines which components the server processes during a request—it doesn’t define what areas of the page are re-rendered when the request completes. To control that behavior, use the rerender attribute on an <apex:actionSupport>, <apex:actionPoller>, <apex:commandButton>, <apex:commandLink>, <apex:tab>, or <apex:tabPanel> component.

So even if you find a workaround to make the <apex:actionFunction> under your <apex:actionRegion> to fire, you wont be able to stop sections from rerendering.

Try using the reRender attribute and rerender the specific sections that you want to.

  • Hi, Mohit, thanks for your feedback. Apologies if I didn't detail my question correctly.. Regardless of which section on the page renders do you know why the function in the Apex class won't call if the commandButton or commandLink is contained within an actionRegion? Thanks again. – RedQueries Nov 27 '17 at 9:29
  • Hi, Just to add further context; the apex function gets called if I don't add reRender="panelName" on my commandLink but it doesn't get called if I use reRender. I'm sure I've done this many times years ago so a but confused what's wrong now. Thanks. – RedQueries Nov 27 '17 at 11:39
  • I am afraid but this a known standard issue on the success community and has not been delivered yet. Please see for yourself, success.salesforce.com/issues_view?id=a1p30000000eQ1RAAU – Mohit Arora Nov 28 '17 at 4:49
  • Hi Mohit, I had come across the article before alright I'm not using Templates though. The article mentions Visualforce templates. The restriction I believe applies to templates alone. – RedQueries Nov 28 '17 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.