You need to sign in to do that
Don't have an account?
Aditya Rayavarapu 5
Passing InputFIELD from one VF page to another
Hello,
I have two VF pages and would like to pass info from the first page to the second.
If the field was an inputTEXT field, then I pass the info using:
Page:
<apex:page controller="xxxx">
<a href="/apex/page2?MyVariable=25">Click Me</a>
<apex:pageblockButtons >
<apex:commandButton value="click Me" action="{!Transfer}" />
</apex:pageblockButtons>
<apex:inputText value="{!Value2Pass}" />
</apex:page>
Controller:
public class xxxx {
public String Value2Pass { get; set; }
public PageReference Transfer() {
PageReference newPAge = page.page2;
newPage.getParameters().put('MyVariable1', Value2Pass);
return newPage;
}
And then using the corresponding code on page 2 to get these values as an OutputText:
<apex:page controller="yyyy">
<apex:Outputtext value="{!Var01}" />
</apex:page>
Controller:
public class yyyy {
public String Var01 { get; set; }
public yyyy() {
Var01 = Apexpages.currentPage().getParameters().get('MyVariable1');
}
}
HOWEVER, how would I achieve the same thing if I wanted to have an InputField in the first page (Case_FirstName__c) and transfer the information in this field as an OutputField in page 2?
I've tried using the standard controller for Case, but it does not work with.
Thanks!
I have two VF pages and would like to pass info from the first page to the second.
If the field was an inputTEXT field, then I pass the info using:
Page:
<apex:page controller="xxxx">
<a href="/apex/page2?MyVariable=25">Click Me</a>
<apex:pageblockButtons >
<apex:commandButton value="click Me" action="{!Transfer}" />
</apex:pageblockButtons>
<apex:inputText value="{!Value2Pass}" />
</apex:page>
Controller:
public class xxxx {
public String Value2Pass { get; set; }
public PageReference Transfer() {
PageReference newPAge = page.page2;
newPage.getParameters().put('MyVariable1', Value2Pass);
return newPage;
}
And then using the corresponding code on page 2 to get these values as an OutputText:
<apex:page controller="yyyy">
<apex:Outputtext value="{!Var01}" />
</apex:page>
Controller:
public class yyyy {
public String Var01 { get; set; }
public yyyy() {
Var01 = Apexpages.currentPage().getParameters().get('MyVariable1');
}
}
HOWEVER, how would I achieve the same thing if I wanted to have an InputField in the first page (Case_FirstName__c) and transfer the information in this field as an OutputField in page 2?
I've tried using the standard controller for Case, but it does not work with.
Thanks!
http://www.forcetree.com/2009/06/passing-parameters-to-visualforce-page.html
<apex:page standardController="Case" extensions="xxxx">
<apex:form >
<a href="/apex/page2?MyVariable=25">Click Me</a>
<apex:commandButton value="click Me" action="{!Transfer}" />
<!--<apex:inputText value="{!Value2Pass}" />-->
<apex:inputfield value="{!obj.accountId}"/>
</apex:form>
</apex:page>
public class xxxx {
public Case obj{get;set;}
public xxxx(apexpages.standardcontroller std)
{
obj = new Case();
}
public String Value2Pass { get; set; }
public PageReference Transfer() {
PageReference newPAge = page.page2;
newPage.getParameters().put('MyVariable1', Value2Pass);
return newPage;
}
}
<apex:page standardController="Case" extensions="xxxx">
<apex:Outputtext value="{!obj.accountId}" />
</apex:page>