1

I am displaying a popup window on visualforce page. My use case is to redirect user to a entirely different visualforce page after user clicks Yes button on popup. Currently, It just stays on the popup and does not redirect.

Here is the visualforce code for popup:

   <!-- Popup code -->
    <apex:outputPanel id="tstpopup">
       <apex:outputPanel styleClass="popupBackground" layout="block" 
         rendered="{!displayPopUp}"/>
         <apex:outputPanel styleClass="custPopup" layout="block" rendered=" 
         {!displayPopUp}">
         <apex:pageMessages />


         <br></br>
         <apex:outputLabel value="Are you sure?"/>
         <br></br>

         <apex:commandButton action="{!withdrawapplication}" 
         styleClass="slds-button slds-button--neutral" value="Yes" 
         rerender="tstpopup"/>

         <apex:commandButton value="No" action="{!cancel}" styleClass="slds- 
         button slds-button--neutral" rerender="tstpopup"/>
         </apex:outputPanel>
  </apex:outputPanel>

Here is the apex method that gets called when user clicks "Yes" button

       public pagereference withdrawapplication() {
       PageReference pr = null;

       pr = Page.withdrawapplication;
       pr.getParameters().put('appId', application.Id);
       displayPopup = false;
       return pr;  

} 
  • 3
    If you're redirecting get rid of the "rerender" attribute on your button. Also reccomended you try pr.setRedirect(true) – gNerb Oct 5 '18 at 18:48

Your Answer

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

Browse other questions tagged or ask your own question.