You need to sign in to do that
Don't have an account?

Difference between commandButton's onClick and action that returns a PageReference
I want to go to a standard page layout (new record edit mode) from clicking on a button in a VF page. I got this to work by using onClick and adding a script in there with the URL of the page I want to go to. Can this be achieved using PageReference (redirect)? Thanks.
Yes you can achieve this by the help of pageReference .
All Answers
Yes you can achieve this by the help of pageReference .
Hi Manoj,
I tried doing it with this code:
public Pagereference goToPageB()
{
Pagereference pr = new Pagereference('url here');
pr.setRedirect(true);
return pr;
}
But it doesn't seem to work. The page does not go to a different page. I put the same URL in onClick and it works. Do I miss something here?