
Dear Community
I am trying to get the standard Salesforce look-up window with an apex:inputField. Here is my VF Page:
<apex:page controller="CancellationReportController" docType="html-5.0" label="Cancellation Report Controller" showHeader="false" sidebar="false"
wizard="true" title="Cancellation Report Form">
<apex:pageMessages/>
<apex:form rendered="true">
<apex:pageBlock title="Cancellation Report Form" rendered="true" mode="edit">
<apex:pageBlockButtons>
<apex:commandButton action="{!cancel}" value="Cancel" id="CancelButton" onclick="window.top.close();"/>
<apex:commandButton action="{!save}" value="Save" id="SaveButton" oncomplete="window.top.close();"/>
</apex:pageBlockButtons>
<apex:pageBlockSection collapsible="false" title="1. Who is responsible for the cancellation / storno?">
<apex:inputField value="{!con.Id}" label="Contact" rendered="true" type="auto"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
And here is my controller:
public with sharing class CancellationReportController
{
public String accId {get; set;}
public String oppId {get; set;}
public Contact con {get; set;}
public CancellationReportController()
{
accId = system.currentPageReference().getParameters().get('accId');
oppId = system.currentPageReference().getParameters().get('oppId');
con = new Contact();
}
public void save()
{
}
public void cancel()
{
}
}
The problem now is that:
- I don't see an input field
- There is no magnifying glass
You can't select a contact since you just create a new contact. For example, use the code below to see the look up for choosing an account for your newly created contact.If you want to look up contact, you need an object that is linked to the contact so you can look up a contact. Thx
<apex:page controller="CancellationReportController" docType="html-5.0" label="Cancellation Report Controller" showHeader="false" sidebar="false"
wizard="true" title="Cancellation Report Form">
<apex:pageMessages />
<apex:form rendered="true">
<apex:pageBlock title="Cancellation Report Form" rendered="true" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!cancel}" value="Cancel" id="CancelButton" onclick="window.top.close();"/>
<apex:commandButton action="{!save}" value="Save" id="SaveButton" oncomplete="window.top.close();"/>
</apex:pageBlockButtons>
<apex:pageBlockSection collapsible="false" title="1. Who is responsible for the cancellation / storno?">
<apex:inputField value="{!con.accountid}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>