+ Start a Discussion
Constantin MitidesConstantin Mitides 

Value for <apex:outputField> is not a dynamic binding! - a visual force page error

Hello, I know this was already posted but the post did not help in my case. please look at the code below.
Why am i receving this? I am doing something similar on a different page and it did not give me this problem (it was with a different field of the same object however.) - does the field type have something to do with it? the field is a picklist value.

Thank you 
<ul>
    <li>
     <span class="label">
       <apex:outputField value="Project Health"/>
      </span>
      <span class="field">
     <apex:image rendered="{!IF(focusedProject.Project_Health__c ="3", true, false)}" value="{!$Resource.RedStatus}" width="40" height="37"/>
     <apex:image rendered="{!IF(focusedProject.Project_Health__c ="2", true, false)}" value="{!$Resource.YellowStatus}" width="40" height="37"/>
     <apex:image rendered="{!IF(focusedProject.Project_Health__c ="1", true, false)}" value="{!$Resource.GreenStatus}" width="40" height="37"/>
      </span>
   </li>
</ul>

 
Constantin MitidesConstantin Mitides
By removing the outputField value ="project health"/> that error stopped, but why is that causing an error? in other li tags I am doing the same thing, for example outputField value ="name" ...etc
Chidambar ReddyChidambar Reddy
Hi constantin,

<apex:outputfield> is used for displaying sObject fields 

if you use standard controller Account, you use outputfield tag to display account name by giving value as "{!account.name}"

that means you can only give a formula expression in the value 

you can use <apex:outputlabel> or standard html tags to display static values


or you can just enter the text inside the span tag


thanks
 
{VikasKhandelwal}{VikasKhandelwal}

Hi Constantin Mitide,

<apex:outputfield> is used to display different kind of fields in According to their type, We can't use static text as output field Value,
It has to bound with some field.

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_outputField.htm

If you see the information mentioned at the bottom of the page mentioned in the link "Value" type is "Object"

value (Object):- A merge field that references the Salesforce field that is associated with this output field. For example, if you want to display an output field for an account's name field, use value="{!account.name}". You cannot associate this output field with a currency merge field if that field value is calculated using dated exchange rates.

Thanks
Vikas

Nathan SNathan S
I saw the other question and agree that you have a different issue.  If you really want to display static text in an apex tag, you can use outputText.  I found it to be an easy way to conditionally render static text, but probably wouldn't use it to just write text to the browser.  OutputText does a lot of cool things (with parameter formatting) so it's worth reading more about (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_outputText.htm).

For example:
<apex:InputField value="{! selItem.Name }"></apex:InputField>
<apex:OutputText value="* new *" rendered="{! isNewItem }"></apex:OutputText>