You need to sign in to do that
Don't have an account?
Rbn
Prepopulating Data from one vf page to another page
Hi,
I have a page which retrieves records of a Custom object.
Now when i click on the edit hyperlink the data should get pre populated to the next page.
Thanks in Advance
What is the exact requirement?
You shared that when you click edit then it will go to another page. Is there any special reason for that? You can made it in same page by using rendering property.
But if you still want to do that in another page then you can use same controller for both the pages and use that object variable in the outputfield in first page and inputfield in second page.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
tahnks for the Quick Reply.
For ur understanding i am posting the below code:
1 st vf PAge:
When i click on edit it navigates me to the below Page:
Do it like this
2nd Controller
public with sharing class tascon {
string st;
public Task tas{get;set;}
public Task_Object__c tasob = new Task_Object__c ();
public tascon (ApexPages.StandardController controller) {
st=System.currentPagereference().getParameters().get('id');
System.debug('@@@@@@@@@3456'+st);
tas = new Task();
tasob = [SELECT Id, Name, Subject__c, Type__c,Assained_To__c FROM Task_Object__c where id=:st];
tas.OwnerId = tasob.Assained_To__c;
tas.Subject = tasob.Subject__c;
tas.WhatId = tasob.YourField;
}
public pagereference getdetails(){
//Do something
return null;
}
}
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Thanks Souvik...i gt it..by assigning inside the Constructor.
But now after saving ..i am able to redirect to the Home Page but the modification which i have done after editing is not getting reflected when i click on Save.
below is my Code::
Can you give your recent controller and vf page code for the edit page. In the 2nd page you are displaying task fields there. But where are you updating the task in the database. i found from your code that you are updating Task_object data but where are you updating task data to get reflected?
Hi Souvik,
My latest Controller::
public pagereference redirect(){
Task_Object__c savtas = (Task_Object__c ) con.getRecord();
update savtas ;
String id = ApexPages.CurrentPage().getparameters().get('id');
PageReference tassav = new PageReference('https://cs17.salesforce.com/home/home.jsp');
tassav .setRedirect(true);
return tassav ;
}
You are updating task object here. But in page you are displaying task data, which is user changing in the vf page. But you are not updating task in the controller. How it can be reflected?