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

Showing a lookup in VisualForce Page
Hi Can we show a lookup relationship in a Visual Force Page.
You need to sign in to do that
Don't have an account?
Hi Can we show a lookup relationship in a Visual Force Page.
Yes. you can certainly achieve this.
Use standardController and "extensions". Put your custom controller in extensions. it will work as you desire
this is example
<apex:page standardController="CustomerFinancialDetail__c" extensions="CustomerFin"/>
you just have to change the constructor thats all.
Cheers
All Answers
You can use <apex:inputfield> to get the same look and fill of your field whether it is picklist,date,lookup...
try bellow code u can get the idea
<apex:page standardController="Opportunity"> <apex:form> <apex:pageBlock title="Opportunity"> <apex:pageBlockSection> <apex:inputField value="{!opportunity.name}"/> <apex:inputField value="{!opportunity.type}"/> <apex:inputField value="{!opportunity.accountid}"/> <apex:inputField value="{!opportunity.StageName}"/> <apex:inputField value="{!opportunity.closedate}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
also checkout the bellow link for visulaforce documentation
Visaulforce documentation
Hi Amar
thanx for the reply
But i wanted a lookup icon appearing on the Visualforce page which i did by the code below.
<apex:page Controller="CustomerFinancialDetail__c">
<apex:form ><apex:inputField value="{!CustomerFinancialDetail__c.Customer_ID__c}"/>
</apex:form>
</apex:page>
But if the do the same with the custom controller i do not get the lookup icon on my VisualForce Page
<apex:page Controller="CustomerFin">
<apex:form ><apex:inputField value="{!t.First_Name__c}"/>
</apex:form>
</apex:page>
public class CustomerFin {
CustomerContactDetail__c sample;
public CustomerContactDetail__c getT() {
sample = [SELECT First_Name__c, Name FROM CustomerContactDetail__c limit 1];
return sample;
}
public void setT(CustomerContactDetail__c value) { sample = value;}
}
If you could help me with this.
regards
niyali
I don't think they have a native component that provides lookup functionality in VF pages. You may have to write something of your own. This can be a combination of an apex:inputField and SF lookup Icon. Take a look:
<apex:inputField id="someId" />
<img src="/s.gif" class="lookupIcon" onblur="this.className='lookupIcon';" onfocus="this.className='lookupIconOn';" onmouseout="this.className='lookupIcon';" onmouseover="this.className='lookupIconOn';" onclick="ShowLookup('{!AnyPropertyFromController}');"/>
You can write JavaScript in your popup lookup page to send back the selected value to the parent opener page.
Regards
metaforce
----------------------------------------------------------------------------------------
Please mark this as the solution if it works and help the community.
Yes. you can certainly achieve this.
Use standardController and "extensions". Put your custom controller in extensions. it will work as you desire
this is example
<apex:page standardController="CustomerFinancialDetail__c" extensions="CustomerFin"/>
you just have to change the constructor thats all.
Cheers
Try using First_Name__r in place of First_Name__c...
Not sure if this would work but in case...
Thanx for the solution it worked fine.
No I am not making it available to portal users. I am currently using it as a Salesforce user for which it is working fine.
Thanks,