+ Start a Discussion
Swapnil PatneSwapnil Patne 

Displaying fields inside two block sections in Visualforce page

Hi,
Need some help identifying what am I doing wrong here?

With below code, I am trying to display account field  inside the two block sections side by side but for some reasons fields don't show up. surely I am missing something here but can't figure it out. 

Please can someone help?

Code:
<apex:page standardController="Account" sidebar="false">
  <apex:form >
    <apex:pageBlock title="{!account.name}" >
       
           <apex:pageBlockButtons >
              <apex:commandButton value="Edit" action="{!edit}"/>
              <apex:commandButton value="Save" action="{!save}"/>
           </apex:pageBlockButtons>
      
        <apex:pageBlockSection title="Details">
           <apex:pageBlockTable value="{!Account}" var="a" columns="4" >
           <apex:column headerValue="Quantitative" />
           
            <apex:outputField value="{! Account.ownerid }" />
            <apex:outputField value="{! Account.Phone }"/>
            <apex:outputField value="{! Account.Name }"/>
            <apex:outputField value="{! Account.Industry }"/>
            <apex:outputField value="{! Account.Account_flag__c }"/>
            <apex:outputField value="{! Account.Tier_Bucket__c}"/>
            <apex:outputField value="{! Account.NPS__c }"/>
            <apex:outputField value="{! Account.M_A_activity__c}"/>
           </apex:pageBlockTable>
           
           <apex:pageBlockTable value="{!Account}" var="b">
               <apex:column headerValue="Qualitative"/>
            <apex:outputField value="{! Account.TL_score__c }"/>
            <apex:outputField value="{! Account.Missed_calls__c }"/>
            <apex:outputField value="{! Account.Adverse_financial_warnings__c }"/>
            <apex:outputField value="{! Account.Change_of_CEO__c }"/>
            <apex:outputField value="{! Account.Change_of_exec_sponsor__c }"/>
            <apex:inlineEditSupport event="ondblClick" />
            </apex:pageBlockTable>

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

Many thanks,
Swapnil
Chintan Jadwani 3Chintan Jadwani 3
Hi Swapnil,

Use variables instead of our list name.

e.g. value="{! Account.ownerid }" should be value="{! a.ownerid }" 

try this for all and see if it works.

Chintan
BALAJI CHBALAJI CH
Hi Swapnil,

When we are trying to iterate records using PageblockTable with StandardController, we should use "recordSetVar". 
I did not understand your usage of ColumnHeaderValue and InlineEdit. Do you want to edit all the fields ?
However, I modified your code and it will display the fields.
 
<apex:page standardController="Account" sidebar="false" recordSetVar="Sample">
    <apex:form >
        <apex:pageBlock title="{!account.name}" >
            
            <apex:pageBlockButtons >
                <apex:commandButton value="Edit" action="{!edit}"/>
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="Details">
                <apex:pageBlockTable value="{!Sample}" var="a" columns="4" >
                    <apex:column headerValue="Quantitative" >
                        <apex:outputField value="{! a.ownerid }" />
                        <apex:outputField value="{! a.Phone }"/>
                        <apex:outputField value="{! a.Name }"/>
                        <apex:outputField value="{! a.Industry }"/>
                        <apex:outputField value="{! a.Account_flag__c }"/>
                        <apex:outputField value="{! a.Tier_Bucket__c}"/>
                        <apex:outputField value="{! a.NPS__c }"/>
                        <apex:outputField value="{! a.M_A_activity__c}"/>
                    </apex:column>
                </apex:pageBlockTable>
                
                <apex:pageBlockTable value="{!Sample}" var="b" >
                    <apex:column headerValue="Qualitative">
                        <apex:column headerValue="Qualitative"/>
                        <apex:outputField value="{! b.TL_score__c }"/>
                        <apex:outputField value="{! b.Missed_calls__c }"/>
                        <apex:outputField value="{! b.Adverse_financial_warnings__c }"/>
                        <apex:outputField value="{! b.Change_of_CEO__c }"/>
                        <apex:outputField value="{! b.Change_of_exec_sponsor__c }">
                            <apex:inlineEditSupport event="ondblClick" />
                        </apex:outputField>
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>        
    </apex:form> 
</apex:page>

Let me know if taht helps you.

Best Regards,
BALAJI
 
Swapnil PatneSwapnil Patne
Hi Balaji,

Thank you for your reply and helping me out. 

With ColumnHeaderValue I want to name those boxes i.e. Box A = Quantitative and Box B = Qualitative and display relevant fields under them, wilth capability to inline edit all. 
Here my aim is to show two boxes side by side Quantitative & Qualitative and display relevant fields under them.


I tried your code, but I get following error:
Error: <apex:column> must be the direct child of either <apex:dataTable> or <apex:pageBlockTable>

Thanks,
Swapnil 
 
BALAJI CHBALAJI CH
Hi Swapnil,

Please try below code with capability of Inline edit all.
 
<apex:page standardController="Account" sidebar="false" recordSetVar="Sample">
    <apex:form >
        <apex:pageBlock title="{!account.name}" mode="inlineEdit" >
            
            <apex:pageBlockButtons >
                <apex:commandButton value="Edit" action="{!edit}"/>
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="Details">
                <apex:pageBlockTable value="{!Sample}" var="a" columns="4" >
                    <apex:column headerValue="Quantitative" >
                        <apex:outputField value="{! a.ownerid}" />
                        <apex:outputField value="{! a.Phone}"/>
                        <apex:outputField value="{! a.Name}"/>
                        <apex:outputField value="{! a.Industry}"/>
                        <apex:outputField value="{! a.Account_flag__c}" />
                        <apex:outputField value="{! a.Tier_Bucket__c}"/>
                        <apex:outputField value="{! a.NPS__c  }"/>
                        <apex:outputField value="{! a.M_A_activity__c}"/>
                    </apex:column>
                </apex:pageBlockTable>
                
                <apex:pageBlockTable value="{!Sample}" var="b" >
                    <apex:column headerValue="Qualitative">
                        <apex:outputField value="{! b.TL_score__c }"/>
                        <apex:outputField value="{! b.Missed_calls__c  }"/>
                        <apex:outputField value="{! b.Adverse_financial_warnings__c }"/>
                        <apex:outputField value="{! b.Change_of_CEO__c  }"/>
                        <apex:outputField value="{! b.Change_of_exec_sponsor__c }"/>
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>        
    </apex:form> 
</apex:page>

Best Regards,
BALAJI