0

I have this below VF page where I am trying to display the contact's name:

<apex:page standardController="Account" >


<apex:pageBlock title="Account's contact">

<apex:pageblocktable value="{! Account.contacts}" var="b">

<apex:outputfiel value="{!b.name}"/>

</apex:pageblocktable>


</apex:pageBlock>



</apex:page>

I use outputfield to show the field's label and value there, but it seems like this tag does not show the label and field. The page is blank. When I use apex:column to display the name it works fine. Why does it not work with outputfield?

2
  • it gives you an error or what ?
    – Nihar
    Apr 1, 2016 at 0:31
  • Nothing shows up. No errors. Is it because I am using page blocktable?
    – SfdcBat
    Apr 1, 2016 at 0:33

1 Answer 1

2

Yes. Pageblocktable is not working with outputfield as you asked..every table needs column to show field

Try this..

<apex:page standardController="Account" >

<apex:form >
    <apex:pageBlock title="Account's contact">

        <apex:pageblocktable value="{!Account.contacts}" var="b">

            <apex:column headerValue="Name">
                <apex:outputField value="{!b.name}"/>
            </apex:column>

        </apex:pageblocktable>    

    </apex:pageBlock>
</apex:form>

</apex:page>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .