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

Passing values from one visualforce page to another
My Requirement is i have two pages in that one page have list of data if i select any one record that value to be display in page 2.
So i have created one controller (Apex Class) like below
public with sharing class Pages_Navigation
{
public Choosename chosenName;
public Choosename getChoosename()
{
if(chosenName == null) chosenName = new Choosename();
return chosenName;
}
public Job_Application__c[] getNumbers()
{
try
{
Job_Application__c[] numbers = [select Name, Status__c
from Job_Application__c order by Name limit :list_size
offset :counter];
return numbers;
}
catch (QueryException e)
{
ApexPages.addMessages(e);
return null;
}
}
public PageReference step1()
{
return Page.JAPage1;
}
public PageReference step2()
{
PageReference oPageRef = Page.JAPage2;
oPageRef.setRedirect(true);
oPageRef.getParameters().put('JobName',string.valueof(chosenName));
return oPageRef ;
}
public class Choosename
{
public string Name {get;set;}
}
}
And Created pages like below
JAPage1............
<apex:page title="SOQL Offset Example Using Visualforce" controller="Pages_Navigation" showHeader="false" sidebar="false" readOnly="true" cache="false">
<apex:sectionHeader subtitle="SOQL Paging Example" title="Job Application Table"/>
<apex:form >
<apex:pageBlock title="Job Application Page1">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!step2}" value="Next"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Job Application Information">
<apex:outputPanel id="jobName">
<apex:detail subject="{!chosenName}"/>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
JAPage2.................
<apex:page title="SOQL Offset Example Using Visualforce" controller="Pages_Navigation" showHeader="false" sidebar="false" readOnly="true" cache="false">
<apex:sectionHeader subtitle="SOQL Paging Example" title="Job Application Table"/>
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection collapsible="false">
<apex:outputPanel id="myPanel">
<apex:pageBlockTable value="{!numbers}" var="n" align="center">
<apex:column >
<apex:outputLink value="https://c.ap1.visual.force.com/apex/JAPage1?Name={!n.Name}">{!n.Name}</apex:outputLink>
</apex:column>
<apex:column headerValue="Click">
<apex:commandLink value="{!n.Name}" rerender="https://c.ap1.visual.force.com/apex/JAPage1">
<apex:param name="chosenName" value="{!n.Name}" assignTo="{!chosenName}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!n.Status__c }" />
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!step1}" value="Previous"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
But i am not getting value in JAPage 1 when i have selected from JAPage 2 list, please can help me on this its very urgent.
Please try:
Lets say you want to pass the value of accountid to the second page 'AddQuantity'.......
Please mark as Solved if this helps you, so that others can benefit!
~Sumit