+ Start a Discussion
OssieOssie 

Display Previous Visualforce Page

Hello,

 

I have a custom button which creates a PDF file and on the pdf file there is a button called "Save".  The "Save" button allows users to save the pdf file in Notes & Attachments and so this works fine.  When i click the "Save" button i would like the previosu page displayed. Is this possible and if so any idea how i can achive this?

 

Many thanks.

Arunkumar.RArunkumar.R

If you are called Save function from controller, just add the code in your pageReference method to redirect page after save,

 

public PageReference forget()

{

PageReference pageRef = new PageReference('/apex/PasswordChange_n1');
return pageRef.setRedirect(true);

}

 

Where "PasswordChange"  is the Pagename.

 

 

 

OssieOssie

Thank you...that sort of worked.

The previous page is being displayed but in a new window.  How do I close down the PDF window / file once saved so that it takes me back to the original vf page?  If that makes sense!

Arunkumar.RArunkumar.R

 

I did't understand your correct requirement. Default Page reference method will not open window as new. when you click Save button it will automatically close the current window and redirected to another page that you wrote in pagereference.

 

Else you can close the current page window by adding oncomplete="window.close()" in your command button.