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
Chandra babu 2Chandra babu 2 

How to Display the lookup values on Vf page

I have taken Two Objects and i am giving the lookup Then how to Display the field values on vf Page.
Subhash RSubhash R

If you are writing VF page on Contact with the help of standard controller, then Use this
Here "contact" refers to Standard Object API name
"account" refers to API name of Lookup Relation with Account in Contact Object
"name" refers to Field in Account Object.(You can give any field API name regarding to your wish)

Hi Chandra,

<apex:inputField value={!ObjectInstance.fieldApiName} />

Let me know if it helps !!

salesforce mesalesforce me
hi check this..
<apex:outputPanel id="userDetails">
        <apex:pageBlockSection columns="1">
            <apex:inputField value="{!order.User__c}">
                <apex:actionSupport event="onchange" action="{!readUser}" reRender="userDetails"/>
            <apex:outputField value="{!}"/>
            <apex:outputField value="{!}"/>
public with sharing class yourController
    // Defining objects
    public User selectedUser { get; set; }
    public Order__c order { get; set; }

    // Constructor where the user data will be pre-populated
    public yourController()
        order = new Order__c();
        order.User__c = UserInfo.getUserId();
        selectedUser = [ Select Id, Email, Phone From User Where Id = :UserInfo.getUserId() ];

    // Method for reading selected user data
    public pageReference readUser()
        selectedUser = [ Select Id, Email, Phone From User Where Id = :order.User__c ];
        return null;

Hi Chandra babu,

Try with below code. With this code you can check in your dev org .
<apex:page Standardcontroller="Contact">
    <apex:form >
        <apex:inputField value="{!Contact.AccountId}"/>

Let me know if it  helps !!