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

Call another VF page from another VF page upon click of the button
I have the below VF Page with 10 custom buttons,
<apex:page id="TeacherKPI_VF" controller="TeacherKPI_VF_Controller">
<apex:form >
<div style="text-align:center;">
<h1 style="text-decoration: underline;">TEACHER'S KPI</h1><br/><br/>
<apex:commandButton value="Lesson Observation" action="{!LessonObservation_VF}"/><br/><br/>
<apex:commandButton value="File Check" action="{!FileCheck_VF}"/><br/><br/>
<apex:commandButton value="Request for Corrective Action" action="{!RequestforCorrectiveAction_VF}"/><br/><br/>
<apex:commandButton value="Withdrawal Trend" action="{!WithdrawalTrend_VF}"/><br/><br/>
<apex:commandButton value="Cost Recoverability Index" action="{!CostRecoverabilityIndex_VF}"/><br/><br/>
<apex:commandButton value="Teacher Parent Dialogue Log" action="{!TeacherParentDialogueLog_VF}"/><br/><br/>
<apex:commandButton value="Training sessions" action="{!TrainingSessions_VF}"/><br/><br/>
<apex:commandButton value="Parent's Survey" action="{!ParentSurvey_VF}"/><br/><br/>
<apex:commandButton value="Student's Survey" action="{!StudentSurvey_VF}"/><br/><br/>
<apex:commandButton value="Leave / MC" action="{!LeaveMC_VF}"/><br/><br/>
<apex:commandButton value="Back" action="{!Back}"/>
</div>
</apex:form>
</apex:page>
When any of the button is click, need to open another VF PAGEs for example
<apex:commandButton value="Lesson Observation" action="{!LessonObservation_VF}"/><br/><br/> need to open VF Page LessonObservation_VF, I am not sure on how to do this, please help
The Class is not complete yet
public with sharing class TeacherKPI_VF_Controller {
public PageReference Back() {
return null;
}
public PageReference LeaveMC_VF() {
return null;
}
public PageReference StudentSurvey_VF() {
return null;
}
public PageReference ParentSurvey_VF() {
return null;
}
public PageReference TrainingSessions_VF() {
return null;
}
public PageReference TeacherParentDialogueLog_VF() {
return null;
}
public PageReference CostRecoverabilityIndex_VF() {
return null;
}
public PageReference WithdrawalTrend_VF() {
return null;
}
public PageReference RequestforCorrectiveAction_VF() {
return null;
}
public PageReference FileCheck_VF() {
return null;
}
public PageReference LessonObservation_VF() {
return null;
}
}
<apex:page id="TeacherKPI_VF" controller="TeacherKPI_VF_Controller">
<apex:form >
<div style="text-align:center;">
<h1 style="text-decoration: underline;">TEACHER'S KPI</h1><br/><br/>
<apex:commandButton value="Lesson Observation" action="{!LessonObservation_VF}"/><br/><br/>
<apex:commandButton value="File Check" action="{!FileCheck_VF}"/><br/><br/>
<apex:commandButton value="Request for Corrective Action" action="{!RequestforCorrectiveAction_VF}"/><br/><br/>
<apex:commandButton value="Withdrawal Trend" action="{!WithdrawalTrend_VF}"/><br/><br/>
<apex:commandButton value="Cost Recoverability Index" action="{!CostRecoverabilityIndex_VF}"/><br/><br/>
<apex:commandButton value="Teacher Parent Dialogue Log" action="{!TeacherParentDialogueLog_VF}"/><br/><br/>
<apex:commandButton value="Training sessions" action="{!TrainingSessions_VF}"/><br/><br/>
<apex:commandButton value="Parent's Survey" action="{!ParentSurvey_VF}"/><br/><br/>
<apex:commandButton value="Student's Survey" action="{!StudentSurvey_VF}"/><br/><br/>
<apex:commandButton value="Leave / MC" action="{!LeaveMC_VF}"/><br/><br/>
<apex:commandButton value="Back" action="{!Back}"/>
</div>
</apex:form>
</apex:page>
When any of the button is click, need to open another VF PAGEs for example
<apex:commandButton value="Lesson Observation" action="{!LessonObservation_VF}"/><br/><br/> need to open VF Page LessonObservation_VF, I am not sure on how to do this, please help
The Class is not complete yet
public with sharing class TeacherKPI_VF_Controller {
public PageReference Back() {
return null;
}
public PageReference LeaveMC_VF() {
return null;
}
public PageReference StudentSurvey_VF() {
return null;
}
public PageReference ParentSurvey_VF() {
return null;
}
public PageReference TrainingSessions_VF() {
return null;
}
public PageReference TeacherParentDialogueLog_VF() {
return null;
}
public PageReference CostRecoverabilityIndex_VF() {
return null;
}
public PageReference WithdrawalTrend_VF() {
return null;
}
public PageReference RequestforCorrectiveAction_VF() {
return null;
}
public PageReference FileCheck_VF() {
return null;
}
public PageReference LessonObservation_VF() {
return null;
}
}
Find the code sample code below to redirect from one vf page to another vf page.
Example :
public PageReference LeaveMC_VF() {
PageReference p = new PageReference('/apex/<your_page_name>');
p.setRedirect(true);
return p;
}
Hope this Helps your problem.
Thanks,
Ram
All Answers
Find the code sample code below to redirect from one vf page to another vf page.
Example :
public PageReference LeaveMC_VF() {
PageReference p = new PageReference('/apex/<your_page_name>');
p.setRedirect(true);
return p;
}
Hope this Helps your problem.
Thanks,
Ram
For those that can further help, you can add the record ID and the end of the link to pass the record id to the vf page you are referring to:
PageReference p = new PageReference('/apex/your_page_name?id=' + opp.id);
"opp" being the object you are calling in your controller (in our case an opportunity):
public with sharing class Yourclass {
public Opportunity opp {get;set;}
Id OpportunityID;
public Yourclass(ApexPages.StandardController controller) {
OpportunityID = controller.getId();
opp = (Opportunity)controller.getRecord();
}
public PageReference OnePageFrancais() {
PageReference p = new PageReference('/apex/your_page_name?id=' + opp.id);
p.setRedirect(true);
return p;
}
}