function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
abhyaabhya 

sharing data between different pages

hello guys,

i need an urgent help. I have to handle the sharing of data between 2 diffrent pages. 
i want to implement the following functionality:
(1).one of the page has been created which shows the complete list of users. 
(2). some users are selected 
(3). they are all together awarded with 500 points and this function is redirected on other page.
 step 3 is done on one click and also on a diffrent page, which should ask about the confirmation for the selected list of users..

i am new to this visualforce, i need the solution urgently, please help me, infact save me....

waiting for a positive reply,

regards,
abhijeet. :)

sinsiterrulezsinsiterrulez

Hi Abhijeet,

As per what I get, you can create other VF page with same controller that of the first page & while redirecting to other page add the setRedirect(false) in the controller so that the new VF can access the data which you have set in the first page & take any necessary actions on other page.

 

If this is not what you want then can you please elaborate your requirement??

SteveBowerSteveBower

sinsiterulez is correct about sharing an instance of a controller with multiple VF pages by not forcing a redirect.

 

 

However you also might be better served, assuming these are simple pages, with just cheating and putting it all in one VisualForce page.   You could define a String called "whichPage" which has an initial value of '1', then bump it to '2', etc. in your actions as appropriate.

 

In your VF, you could use

 

<apex:pageBlock rendered="{!whichPage= '1'}">

...... page 1 stuff

</apex:pageBlock>

 

<apex:pageBlock rendered={!whichPage = '2'}">

..... page 2 stuff...

</apex:pageBlock>

 

etc.   This reduces the number of pages and redirects, etc.  If your pages are long and complicated I suggest going with the multiple page design, but this method is cheap and easy assuming you don't have many states.

 

Just a thought, Best, Steve.

abhyaabhya

thanks for replying,

 

actually i am new to this and donno anything about it. can you please suggest me the links for studying apex  and also a code snippet that can be helpful.

 

i have been assigned to this task yesterday and my boss needs the result by next week. 

 

i will like to elaborate the the project details:

 

1. some users are selected using the checkbox in the search list produced from the leads data.

2. those users are the lucky people who will get 500 points from my company.

     - there will be a button provided which will be used to grant 500 points to the people.

3. i have to process the list of selected people on a diffrent page by changing the attribute property point_granted from 0      to 500 automatically when the button on page 1 is clicked.

 

hoping for positive reply again....

 

abhijeet. :)

 

abhyaabhya

1 more thing i will like to share is that , the page 1 from which the data is selected is not a visualforce page , it is a normal salesforce page displaying data. i will have to provide a button that will take me to the new VF page containing the list of selected people using the checkbox.

 

thank you,

hoping for reply,

 

abhijeet.

sunil_kumarsunil_kumar

Hi,

 

As you said that you are not selecting user from visualforce page but from salesforce page so include a list button in list view and direct it to your visualforce page. in that page use extension as:

public class selectedRecords

{   
ApexPages.StandardSetController setCon;
public selectedSizeWorkaround(ApexPages.StandardSetController controller)

 {setCon = controller;}
}

 

display selected items in next page by using(suppose i am selecting leads)

<apex:pageBlockTable value="{!selected}" var="leads" id="mutab">
<apex:column value="{!leads.name}" id="leadname"/>
<apex:column value="{!leads.status}" id="leadstatus"/>
</apex:pageBlockTable>

 

also include field which you want to change and then use save commandbutton....

 

For reference you can check 

Mass-Updating Records with a Custom List Controller in visualforce developer guide