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

Display Previous Visualforce Page



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.


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.





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!



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.