0

I am trying to display a form wrapped in a table with inputfield but it does not return any value although the console says there is no error with my code.

Contact Please see my code below;

<apex:page sidebar="false" showHeader="false" standardController="Account">
    <apex:tabPanel title="Account">
    <apex:tab label="Account Section">
            <apex:form>
            <apex:pageBlock>
                <apex:pageBlockSection>
                    <apex:outputField value="{!Account.Name}"/>
                    <apex:outputField value="{!Account.Phone}"/>
                    <apex:outputField value="{!Account.BillingCity}"/>
                    <apex:outputField value="{!Account.ShippingState}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>
                </apex:form>
        </apex:tab>
        <apex:tab label="Contact Section">
            <apex:form >
            <apex:pageBlock >
                <apex:pageBlockSection title="Contact Details">
                 <apex:pageBlockTable value="{!Account.contacts}" var="contact">-->
                       
                        <apex:inputField value="{!contact.Name}"/>
                        <apex:inputField value="{!contact.Phone}"/>
                        <apex:inputField value="{!contact.Email}"/>
                    </apex:pageBlockTable>    
                    

                </apex:pageBlockSection>
            </apex:pageBlock>
                </apex:form>
        </apex:tab>
        
    </apex:tabPanel>
    
</apex:page>

What could I be doing wrong?

1 Answer 1

0

You need to place each field in an apex:column. This is true for both apex:pageBlockTable and apex:dataTable.

 <apex:pageBlockTable value="{!Account.Contacts}" var="Contact">
   <apex:column>
      <apex:inputField value="{!Contact.Name}"/>
   </apex:column>
   <apex:column>
      <apex:inputField value="{!Contact.Phone}"/>
   </apex:column>
   <apex:column>
      <apex:inputField value="{!Contact.Email}"/>
   </apex:column>
 </apex:pageBlockTable>    
1
  • It works. Thanks, man.
    – Afonja
    Commented Aug 9, 2022 at 22:56

You must log in to answer this question.

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