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?

  • it gives you an error or what ? – Nihar Apr 1 '16 at 0:31
  • Nothing shows up. No errors. Is it because I am using page blocktable? – SfdcBat Apr 1 '16 at 0:33
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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.