+ Start a Discussion
Jonathan OsgoodJonathan Osgood 

Lookup will not render in Visual Force

I know this has been convered, but I am still unable to properly display a lookup in my VF page. InputField references an actual lookup to Account. I've tried adding !Form.AccountID with no luck...

Here is the code:
 
<apex:page standardController="Form__c" showHeader="false" sidebar="false" standardStylesheets="false">

   <apex:form >

    <label>
      Which high school do you attend?<br/>
    </label>

    <div>
        <apex:inputField value="{!Form__c.High_School_Attended__c}" />
    </div>  

   </apex:form>

</apex:page>

Here is the field. 

User-added image
Best Answer chosen by Jonathan Osgood
William TranWilliam Tran
You can define any other stylesheet in your page using <apex:stylesheet value="/resources/htdocs/css/basic.css"/>

That said, the order in which it loads may not be the last one, so if you really need to override than as a general HTML/CSS rule - inline CSS always overrides a stylesheet. 

If you use the same style many times, you can put it in a controller.
 
****** Controller
public String strStyleSheet {get;set;}
 
public void ControllerConstructor() {
     strStyleSheet = 'bgcolor="red"';
}
 
******* VF Page
<apex:outputText value="something" style="{!strStyleSheet}" />

thx.

All Answers

William TranWilliam Tran
Jonathan, remove the standardStylesheets ="false"

like this:

<apex:page standardController="Form__c" showHeader="false"sidebar="false" >

and you should be good to go.

thx

By the way you can still use other custom stylesheets without setting that parameter to false.

 
Jonathan OsgoodJonathan Osgood
That worked, thank you! It did override my css though... How can I use custome CSS without setting that parameter to false?
William TranWilliam Tran
You can define any other stylesheet in your page using <apex:stylesheet value="/resources/htdocs/css/basic.css"/>

That said, the order in which it loads may not be the last one, so if you really need to override than as a general HTML/CSS rule - inline CSS always overrides a stylesheet. 

If you use the same style many times, you can put it in a controller.
 
****** Controller
public String strStyleSheet {get;set;}
 
public void ControllerConstructor() {
     strStyleSheet = 'bgcolor="red"';
}
 
******* VF Page
<apex:outputText value="something" style="{!strStyleSheet}" />

thx.
This was selected as the best answer
Jonathan OsgoodJonathan Osgood
Perfect, thank you!