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
Patrick C Mayer 91Patrick C Mayer 91 

Visualforce not updating variables?

I deleted parts of my code that are not relevant to this question. Essentially this should rerender the page causing it to call openPopup(). Which then opens the pop up and then calls closePopup, which should set displayPopUp to false. However it would seem displayPopUp is not being updated properly at least on the VF side.

<apex:page controller="IdleCasePopUp">
    <apex:form > 
    <apex:pageBlock id="myPageId">
        <apex:actionPoller reRender="myPageId" interval="10" status="renderMeStatus"/>
        <apex:actionStatus id="renderMeStatus" onstop="openPopup()"/>
        
<script id="script">
    var newWin=null;
    function openPopup() {
        var url="/apex/autoOpen";
      
        if ({!displayPopup}) {
           newWin=window.open(url, 'Popup','height=500,width=600,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
           closePopup();
        }
    }

</script>
    </apex:pageBlock>
    </apex:form>
</apex:page>

global class IdleCasePopUp implements Schedulable {      
    public boolean displayPopup {get; set;}
    
    public IdleCasePopUp() { 
    	displayPopUp = true;
    }
    
    public void closePopup() {  
        displayPopup = false;    
    }     
    
    public void showPopup() {        
        displayPopup = true;    
    }
    
}


Ramu_SFDCRamu_SFDC
Add the below line into the vf page and  you should be good. Currently the method within the javascript is not calling the controller method closePopup() hence the issue.

<apex:actionFunction name="closePopup" action="{!closePopup}" reRender="myPageId" />