I am currently calling an APEX method (in a controller) with variables from Javascript. I would like to reflect the changes made in the controller in the page. I am using an apex:actionFunction to call the method and then I am using another actionFunction to reRender a block of the page. I believe the changes are taking place in the controller (I can make logs of the changes) and I think the rerender is working, but the new values are not being shown on the page. They will only be shown if I force a refresh by pressing a button, or similar.

I have been looking at a number of examples, but I have not found anything useful for this particular issue. Here is a summarized version of my code:


<apex:actionFunction name="rerenderInfoBlock" rerender="InfoBlockContainer" />


<apex:actionFunction action="{!runControllerMethod}" name="newCustomerRecruitMonitorSelected" rerender=""> 
    <apex:param name="monitorId" assignTo="{!monitorId}" value="" />


alert("{!objectReference.changedProperty}");//this property will not be changed


public PageReference runControllerMethod(){
    //get the parameters etc and make a change to a few properties
    return null;

Is there some step I am missing? I am guessing I have to tell the javascript to somehow go back to the server and get the updated values, but I am not sure how to do this... Would be great if any answers contained links to references. Thanks.

Edit, Here is the output panel that I am trying to rerender:

<apex:outputPanel id="InfoBlockContainer">
    <apex:pageBlock id="InfoBlock" rendered="{!showBlock == true}">
  • Also use a single Form Tag .And please use the getter and setter for all the properties you want back on page Dec 10, 2012 at 6:57

1 Answer 1


Several possibilities here.

  • I'm not sure an actionFunction that has no controller action is guaranteed to re-poll the controller. You should just move your rerender property of "InfoBlockContainer" to your newCustomerRecruitMonitorSelected actionFunction.
  • Your JS code should be calling newCustomerRecruitMonitorSelected(parameterVar), not runControllerMethod(parameterVar) -- the "name" param of an actionFunction becomes the JS function, while JS knows nothing about the controller param names. (To reduce errors like this on my own part, I generally name my controller methods and my actionFunctions the same thing, where appropriate.) This error would show up in a JS console/debugger.
  • a JS actionFunction method fires instantly, and asynchronously does the rerender. Therefore, your alert statement will always return the unchanged property, since it's pretty much a guarantee that the browser will fire it before the async request returns and does the rerender.

Without a little more detail about what you're rerendering and how, it's hard to diagnose further, but start with those.

  • Thanks for the answer. It has been helpful so far. The newCustomerRecruitMonitorSelected was a mistake on my part and should have been runControllerMethod (sorry for the confusion). Your 1st and 3rd point are correct. If I put an alert before the 'rerender' to give it more time, the page will update. I am not sure about how to fix this though. You say just move the render property of 'InfoBlockContainer' to the Controller function, but I am not sure what this involves. I will update the question with the 'InfoBlockContainer' item.
    – lindon fox
    Dec 10, 2012 at 6:53
  • What i'm saying is put the "rerender="InfoBlockContainer"" into the newCustomerRecruitMonitorSelected actionFunction declaration, and delete the rerenderInfoBlock actionFunction and its calling JS. You only need one actionFunction, since the rerender occurs after the action is complete.
    – jkraybill
    Dec 10, 2012 at 6:58
  • OK I understand you now - sorry. I thought you were saying to put it in the controller side of the code. Got it now and it works - thanks.
    – lindon fox
    Dec 10, 2012 at 7:06
  • To address the first point in the answer - the lack of an actionfunction doesn't stop the controller being polled. The full postback still takes place and the latest values from the controller are used to construct the elements of the page that are rerendered. Dec 10, 2012 at 8:25

You must log in to answer this question.

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