You need to sign in to do that
Don't have an account?
MariP
Visual force Page : save OK but stays on EDIT page
Hi,
I begin on Visual Force and Apex...
I have a VF page where I want to save a pageblocktable, and then go back on the previous page. It saves, but stays on the page...
Here is my class :
public class CallPlanResultController {
public List<Call_Plan_Line_Result__c> resultList {get;set;}
ApexPages.StandardController controller;
public Call_Plan_Line__c callPlanLine {get;set;}
public Integer resultListSize {
get{
return resultList.size();
}
}
public CallPlanResultController(ApexPages.StandardController inputController){
controller = inputController;
callPlanLine = (Call_Plan_Line__c)controller.getRecord();
resultList = new list<Call_Plan_Line_Result__c>();
for (Call_Plan_Line_Result__c result:[select id,name,Action_Date__c,Action_Type__c,Info_Date__c,
Nb_of_days_of_StockOut__c,New_needs__c,Order_received__c,Product_Code__c,Product_Name__c,Stock__c,
To_Process__c,Variance_ROP_Order__c,Comment__c,Objective_Quantity__c,Order_Quantity__c,
Result_Quantity__c,DMDUnit__c,Order_Qty_Equiv__c,Max_Min__c,Consistency__c,Back_Order_Top__c,
Back_Order_Observation__c,Back_Order_Qty__c,New_Product_Code__c,New_Product_Name__c
from Call_Plan_Line_Result__c where call_plan_line__c = :controller.getId()]){
resultList.add(result);
}
}
public void save(){
PageReference retour = controller.save();
update resultList;
}
}
and in my page I only use the save function of the controller :
<apex:commandbutton value="{!$Label.CORE_Btn_Save}" action="{!save}"/>
Any help will be appreciated....
Thank you sravu !
I made it simpler than what you recommanded, and it works :
public PageReference save(){
PageReference retour = controller.save();
update resultList;
return retour;
}
Thank you again !
All Answers
Change the following method as:
public void save(){
PageReference retour = controller.save();
update resultList;
}
public PageReference save() {
PageReference retour = controller.save();
update resultList;
return ApexPages.StandardController(<object name>).view();
}
Thank you sravu !
I made it simpler than what you recommanded, and it works :
public PageReference save(){
PageReference retour = controller.save();
update resultList;
return retour;
}
Thank you again !
The following statement will take you to the standard detail page.
return ApexPages.StandardController(<object name>).view();
You can use this if u need the standard look and feel