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
vanessa veronvanessa veron 

to pass information from page 1 topage 2

Hello ...
How can I do to pass information from my page 1 to my page 2 ?

When I click the button M (modify) I want the page 2 be loaded with page1  information (mail).

Thank you!!!!!

The code:
APEX:

global List<GetJobValue__c> recupererInfosJob{get;set;} 
public String garderJobInfo;
global String mail{get;set;}

public BBBB(ApexPages.StandardController controller) {
            jobRecords = new List<CronTrigger>();
            jobRecords = [SELECT  CronJobDetail.Name, CreatedDate, State, PreviousFireTime, NextFireTime,CronExpression FROM CronTrigger where OwnerId = '00520000003HHTGAA4'];
            enabledMois = true;
            enabledMoisPartie2 = true;
            enabledSemaine=true;
                       
            mail=getMail();         
            
        }

global void setMail(String mail) {
    this.mail= mail;
}

global String getMail() {
    return mail;
}

public PageReference modifier(){
modif();   
PageReference pageRef= new PageReference('/apex/BBBBPage2');
pageRef.setRedirect(true);        
return pageRef;
}

public void modif(){
if(!String.isBlank(strJobName))
{
    recupererInfosJob = new List<GetJobValue__c>();
    recupererInfosJob = [SELECT  Mail__c FROM GetJobValue__c where nomJob__c =: strJobName];

    for(GetJobValue__c a: recupererInfosJob){
       string recordString = a.Mail__c;
       garderJobInfo = recordString;

    }
}
else
{
system.debug('NOT Job Name');
}

setMail(garderJobInfo);

}
VISUALFORCE:

PAGE 01:

<apex:actionfunction name="callModify" action="{!modifier}" rerender="panelRefresh">
            <apex:param value="" name="ParamModify" assignTo="{!strJobName}" />
          </apex:actionFunction>

<apex:pageBlockTable value="{!jobRecords}" var="ac" id="pbBlockTable">
                <apex:column headervalue="Expression" value="{!ac.CronExpression}"/>

                
                 <apex:column >
                    <apex:commandButton value="M" onClick="callModify('{!ac.CronJobDetail.Name}'); return false;"/>
                </apex:column>
                  
              </apex:pageBlockTable>

PAGE 02:

Mail..........:&nbsp;<apex:inputText styleClass="classeBig" value="{!mail}"/><br /><br />


Best Answer chosen by vanessa veron
Ramesh KallooriRamesh Kalloori
hi ,

change from <apex:inputText value="{!$CurrentPage.parameters.mailPG2}"/>
to below.


<apex:outputText value="{!$CurrentPage.parameters.mailPG2}"/>

thanks,
Ramesh

All Answers

Ramesh KallooriRamesh Kalloori
use the below modified code.

public PageReference modifier(){
modif();  
PageReference pageRef= new PageReference('/apex/BBBBPage2');
pageRef.getParameters().put('account',s1);//s1 is the valeof parameter
pageRef.setRedirect(true);       
return pageRef;
}

in page2 access s1 using below statement.

{!$CurrentPage.parameters.account}

thanks,
RAmesh
vanessa veronvanessa veron
thank you....

but where I use {!$CurrentPage.parameters.account} ?
could you inform me the complete instruction?


IN:
pageRef.getParameters().put('account',s1);

account can be a variable that will contain the value passed to S1?

pageRef.getParameters().put(VariableString,s1);




vanessa veronvanessa veron
I have an error: Error: Field parameters does not exist. Check spelling.

APEX:

global string mailPG2{get;set;}

public PageReference modifier(){

modif();  

PageReference pageRef= new PageReference('/apex/BBBBPage2');
pageRef.getParameters().put('mailPG2' ,garderJobInfo);
pageRef.setRedirect(true);       
return pageRef;

}


PAGE:

Mail..........:&nbsp;<apex:inputText  value="{!$CurrentPage.parameters.mailPG2}"/><br /><br />

Ramesh KallooriRamesh Kalloori
hi ,

change from <apex:inputText value="{!$CurrentPage.parameters.mailPG2}"/>
to below.


<apex:outputText value="{!$CurrentPage.parameters.mailPG2}"/>

thanks,
Ramesh
This was selected as the best answer
vanessa veronvanessa veron
Thank you...

But isnt it possible to do that for INPUT TEXT??

how do I get a select Option with selected values​​?


Ramesh KallooriRamesh Kalloori
you need to write the controller for page2.

please go through the below sample code.

<apex:page controller="ParamCon" >
<apex:form >
 <apex:commandLink action="{!Send}" value="Send">
 <apex:param name="h" value="Hai" assignTo="{!s1}"/>
 </apex:commandLink>
  </apex:form>
</apex:page>
public class ParamCon {
public String s1{get;set;}
    public PageReference Send() {
         PageReference openvfpage = New Pagereference('/apex/ParamRecieveVF');   
        openvfpage.getParameters().put('account',s1);
        openvfpage.setRedirect(true);
        return openvfpage ;         
    }
}
<apex:page controller="ParamRecieveCon" >
<apex:form >
 {!$CurrentPage.parameters.account}
 <apex:inputText value="{!s}"/>
</apex:form>
</apex:page>
public class ParamRecieveCon {
public String s{
get{
return ApexPages.currentPage().getParameters().get('account');}
set{}
}
}

thanks,
Ramesh



vanessa veronvanessa veron
Thank you!!!
Ramesh KallooriRamesh Kalloori
if the problem solved make it as best answer it is useful to other community members.

thanks,
Ramesh