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

How do I navigate from one Visualforce page to another?
Hi,
I have a visualforce page created with some fields and a button basically a command button. Now I want to navigate to another page on click of the button i.e x page has button, on click of which i want to load the browser with page y. How do i do that?
Thanks in Advance,
Ravindra
No I found the solution for this
U jus need to put action='/apex/Y' in the commandButton attribute. It will work.
Thanks for your time
All Answers
Hi..
For that first you have to create two VF pages x and y. On click of the command button of page x, you need to mention the action, say "step2", which will be defined in the controller class like this :
public class sampleController{
public PageReference step1() {
return Page.pageX;
}
public PageReference step2() {
return Page.pageY;
}
}
Now, create page "pageX" :
<apex:page controller="sampleController">
<apex:form>
<apex:pageBlock>
<apex:pageBlockButtons>
<apex:commandButton action="{!step2}" value="Next"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
also, create page "pageY" :
<apex:page controller="sampleController">
<apex:form>
<apex:pageBlock>
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Thanks for the reply, But its opening page Y in a different browser or in different tab. But I want it to be opened in the same brower. How do I do that?
For that you have to add "standardController" or "controller" attribute in your Visual Force Page.
Suppose, you are adding like this in both the pages "pageX" and "pageY" :
<apex: page standardController="Account">
Then both pages will open under Accounts Tab.
No I found the solution for this
U jus need to put action='/apex/Y' in the commandButton attribute. It will work.
Thanks for your time
http://sales-fundamentals.blogspot.in/2014/09/how-to-navigate-to-another-page-visual.html