+ Start a Discussion
BARJRDBARJRD 

Placement of Input field for Lookup field is too low

Whenever I create an inputfield on a Visualforce page for a Lookup field, it is displays lower than other input fileds.  Here is some sample code --- in this example, the input field for Account appears lower thatn the field for lastname:

 

<apex:page standardController="Contact" > <apex:form > <apex:sectionHeader title="Contact"> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons > <apex:pageBlockSection > <apex:inputField value="{!Contact.AccountID}"></apex:inputField> <apex:inputField value="{!Contact.Lastname}"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> </apex:sectionHeader> </apex:form> </apex:page>

 What is wrong?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
MVJMVJ

Made two simple changes.  Added Mode = Edit  and Columns = 2

 

Good luck

 

Here is the updated code:

 

<apex:page standardController="Contact" > <apex:form > <apex:sectionHeader title="Contact"> <apex:pageBlock mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="2"> <apex:inputField value="{!Contact.AccountID}"></apex:inputField> <apex:inputField value="{!Contact.Lastname}"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> </apex:sectionHeader> </apex:form> </apex:page>

 

 

 

All Answers

MVJMVJ

Made two simple changes.  Added Mode = Edit  and Columns = 2

 

Good luck

 

Here is the updated code:

 

<apex:page standardController="Contact" > <apex:form > <apex:sectionHeader title="Contact"> <apex:pageBlock mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:pageBlockSection columns="2"> <apex:inputField value="{!Contact.AccountID}"></apex:inputField> <apex:inputField value="{!Contact.Lastname}"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> </apex:sectionHeader> </apex:form> </apex:page>

 

 

 

This was selected as the best answer
BARJRDBARJRD
You're Awesome -- Thanks!