I have two visualforce page, the first one will ask applicant to enter first, last name and SSN, and then the second page will ask applicant to enter information if the contact is not in our system. How can I make SSN, First and last name show up automatically in the second visualforce page since they have already entered once in the first visualforce page? A great guy has established following code for us and I am just trying to make some small modifications here and there. Any help will be really appreciated.
Here is the first visualforce page(partial):
<apex:page controller="landingPageController">
<td>
<apex:inputText value="{!searchSocialSecurityNumber}" />
</td>
<td> </td>
<td>
<apex:inputText value="{!searchFirstName}" />
</td>
<td>
<apex:inputText value="{!searchLastName}" />
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="4" style="text-align:center; ">
<apex:commandButton value="Submit" action="{!searchBySocialSecurityNumber}" reRender="contactsArea, theNewButton" />
</td>
</tr>
</apex:page>
Here is second visualforce page:
<apex:page controller="newDealCtrl">
…
</apex:pageBlockSection>
<apex:pageBlockSection title="Contact Information" columns="1">
<apex:inputField value="{!newContact.FirstName}" required="True"/>
<apex:inputField value="{!newContact.LastName}" required="True"/>
<apex:inputField value="{!newContact.SSN__c}" required="True"/>
</apex:pageBlockSection>
…
</apex:page>
Here is the apex for the firs page:
public class landingPageController {
public String searchFirstName {get; set;}
public String searchLastName {get; set;}
public String searchSocialSecurityNumber {get; set;}
public Boolean hasClickedSearch {get; set;}
public void searchBySocialSecurityNumber() {
String socialSecurityQueryString = searchSocialSecurityNumber.replaceAll('-', '');
String firstNameQueryString = '';
if(searchFirstName != null) {
if(searchFirstName.length() > 0) {
firstNameQueryString = '%' + searchFirstName.substring(0, 1) + '%';
}
}
String lastNameQueryString = '';
if(searchLastName != null) {
if(searchLastName.length() > 0) {
lastNameQuerySTring = '%' + searchLastName.substring(0, 1) + '%';
}
}
public PageReference goToTheBlankCreationPage() {
PageReference PR = Page.create_new_deal;
PR.setRedirect(True);
return PR;
}
}
}
Here is the apex for second page:
public class newDealCtrl{
public Account newAcct {get;set;}
public Contact newContact {get;set;}
public newDealCtrl(){
newAcct= new Account();
newContact = new Contact();
}
public PageReference save(){
try{
OpportunityContact__c opptyContact = new OpportunityContact__c();
newAcct.Type = 'Applicant';
newAcct.Industry = 'Transportation';
newContact.AccountId = newAcct.Id;
Upsert newContact;
PageReference PR = Page.landingPage;
PR.setRedirect(True);
PR.getParameters().put('reply','a');
Return PR;
}
}
}