+ Start a Discussion

displaying selected leads record in vf page to another vf page

Hi everyone,


I am selecting lead record in one visualforce page by using checkbox and storing the records in list in apex class. When i am directing my page to another page which uses same extension as that of previous page,size of list becomes zero means it doesnot contain any records when i navigate to other page. So i am not able to fetch record from list.


My requirement is to select lead record on one vf page by clicking on checbox and then displaying them in next vf page so that i can perform further actions.


Can anyone help me to get out of this problem? 


Have you considered using an output panel and displaying the information on the same page?


You can use the Ajax wrapping tools in VF to show them on the same page while only refreshing a section of the page.


How are you switching from one page to the other?  If the two pages use the same controller/extensions, they would share state, but not if you redirect to the second page, which is equivalent to loading a new instance. 


The first page needs to return the page reference for the second page from the action method that sets the list.


Thanks aballard,


after removing redirect i am getting desired display of selected leads on next visualforce. now i want to change the status of all selected leads in previous page. I am using apex inputfield to change staus of all leads but when i am clicking on save button,it shows an error message as required field are missing. i only want to update lead status field in existing records. i also try by writing apex code for saving status but still not able to do it.


Can you please help me out in this problem and suggest something. Thanks for previous reply.


hello sunil , i also need to do the same thing of transferring selected fields from one VF page to other  VF page. can you please help me with the code. i m new and donno anything about apex and VF too. or can you suggest the best material to study this thing fast and implement it...

hoping for your reply,




Hi Abhya,


For this follow the given points:


1. Use one controller/extension for both vf pages.

2. While navigating from one page to other page, simply return the pagereference of second page so that state of controller/extension will be maintained so don't redirect the page otherwise it will load new instance of controller/extension.


Go through creating wizard in visualforce developer guide.