0

How can I refresh a visualforce page after the save button on the page is clicked? I've tried a few methods, and none have provided the behavior I am looking for.

  1. window.location.reload()

  2. window.location.reload(true)

  3. Returning the page's url from a function.

    public pagerefrence methodname(){
        PageReference pr = new PageReference('/apex/VFPage');
        pr.setRedirect(true);
    }
    
3
  • 1
    Can you add Save button code also Commented Feb 6, 2017 at 13:27
  • I think you are partially refreshing the page with the help of rerender attribute.
    – Saroj Bera
    Commented Feb 6, 2017 at 13:29
  • Without making an edit to your question, and including the save button and possibly some of the visualforce page, it will be difficult to provide a quality answer to this question. You may have rerender's specified, or other code which is preventing a rerender. Commented Feb 6, 2017 at 14:47

2 Answers 2

1

Whenever I need to rerender a page, I use a function which returns a null PageReference.

public PageReference RerenderPage() {
    return null;
}

This will rerender any sections specified in a reRender attribute on your button, and if none are specified, it will rerender the entire page.

0

You can refresh your page by two ways.

  1. In yourmethod put pagereference code and give the same link.

    public pagerefrence methodname(){
         return new PageReference('/apex/VFPage');
    }
    
  2. Put oncomplete in your commandlink and reload the page using javascript:

    oncomplete="window.location.reload();"
    

You must log in to answer this question.

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