You need to sign in to do that
Don't have an account?
Sarvesh Prajapati
Visual force page not working
Hi,
I have created a visual force page. There are two objects Job Application and Candidate.
I'm displaying the name of Job Application in VF Page. When a name is clicked it should display candidate's first name, but its not displaying. Here is the code I have written.
VF Page
<apex:page controller="D_Controller">
<apex:form >
<apex:datalist value="{!JA}" var="item">
<apex:commandLink action="{!JAclicked}" rerender="CandidateDetails">
<apex:outputtext value="{!item.Name__c}" />
<apex:param name="id" value="{!item.id}" assignTo="{!selectedCandidate}"/>
</apex:commandLink>
</apex:datalist>
</apex:form>
<apex:outputPanel id="CandidateDetails">
<apex:repeat value="{!CandidateInfo}" var="item">
<p>Custom Control Demo "{!item.First_Name__c}" </p>
</apex:repeat>
</apex:outputPanel>
</apex:page>
Controller
public class D_Controller
{
public id selectedCandidate{get;set;}
public list<Candidate__c> CandidateInfo{get;set;}
public list<Job_Application__c> getJA()
{
return [select Name__c, Position__c, Candidate__c from Job_Application__c limit 5];
}
public void JAclicked()
{
CandidateInfo = [select First_Name__c, Last_Name__c from Candidate__c where ID = :selectedCandidate] ;
}
}
Please let me know hwat should I modify
I have created a visual force page. There are two objects Job Application and Candidate.
I'm displaying the name of Job Application in VF Page. When a name is clicked it should display candidate's first name, but its not displaying. Here is the code I have written.
VF Page
<apex:page controller="D_Controller">
<apex:form >
<apex:datalist value="{!JA}" var="item">
<apex:commandLink action="{!JAclicked}" rerender="CandidateDetails">
<apex:outputtext value="{!item.Name__c}" />
<apex:param name="id" value="{!item.id}" assignTo="{!selectedCandidate}"/>
</apex:commandLink>
</apex:datalist>
</apex:form>
<apex:outputPanel id="CandidateDetails">
<apex:repeat value="{!CandidateInfo}" var="item">
<p>Custom Control Demo "{!item.First_Name__c}" </p>
</apex:repeat>
</apex:outputPanel>
</apex:page>
Controller
public class D_Controller
{
public id selectedCandidate{get;set;}
public list<Candidate__c> CandidateInfo{get;set;}
public list<Job_Application__c> getJA()
{
return [select Name__c, Position__c, Candidate__c from Job_Application__c limit 5];
}
public void JAclicked()
{
CandidateInfo = [select First_Name__c, Last_Name__c from Candidate__c where ID = :selectedCandidate] ;
}
}
Please let me know hwat should I modify
The parameter you are passing to the controller should be the candidate Id, not the Job Application Id.
VF Page
<apex:page controller="D_Controller">
<apex:form >
<apex:datalist value="{!JA}" var="item">
<apex:commandLink action="{!JAclicked}" rerender="CandidateDetails">
<apex:outputtext value="{!item.Name__c}" />
<apex:param name="id" value="{!item.candidate__c}" assignTo="{!selectedCandidate}"/>
</apex:commandLink>
</apex:datalist>
</apex:form>
<apex:outputPanel id="CandidateDetails">
<apex:repeat value="{!CandidateInfo}" var="item">
<p>Custom Control Demo "{!item.First_Name__c}" </p>
</apex:repeat>
</apex:outputPanel>
</apex:page>
Change the item.Id to item.candidate__c.
Thanks
Ramya
All Answers
You have use the below code to open the record:
Please do let me know if it helps you.
Regards,
Mahesh
The parameter you are passing to the controller should be the candidate Id, not the Job Application Id.
VF Page
<apex:page controller="D_Controller">
<apex:form >
<apex:datalist value="{!JA}" var="item">
<apex:commandLink action="{!JAclicked}" rerender="CandidateDetails">
<apex:outputtext value="{!item.Name__c}" />
<apex:param name="id" value="{!item.candidate__c}" assignTo="{!selectedCandidate}"/>
</apex:commandLink>
</apex:datalist>
</apex:form>
<apex:outputPanel id="CandidateDetails">
<apex:repeat value="{!CandidateInfo}" var="item">
<p>Custom Control Demo "{!item.First_Name__c}" </p>
</apex:repeat>
</apex:outputPanel>
</apex:page>
Change the item.Id to item.candidate__c.
Thanks
Ramya