function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Frank TimmonsFrank Timmons 

Trying to create a 3 column section on the Account object

I'm not a coder so I searched for how to accomplish getting a section to have 3 (or more) columns and I did find something but the code isn't working.  Can someone help?

<apex:page>
<apex:pageBlockSection title="Labor Breakdown" columns="3">
              
<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Estimate1</apex:outputLabel>
<apex:inputField value="{!obj__c.Estimate__c}" style="width:80px"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Hours1</apex:outputLabel>
<apex:inputField value="{!obj__c.Hours__c}" style="width:80px"/>
</apex:pageBlockSectionItem>
          
<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Rate1</apex:outputLabel>
<apex:inputField value="{!obj__c.Rate__c}" style="width:80px"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:page>
Best Answer chosen by Frank Timmons
SonamSonam (Salesforce Developers) 
Steps on how to embed a VF page on a standard page layout is explained in the link below:
https://help.salesforce.com/apex/HTViewSolution?id=000005105&language=en_US
You should use inputtext to capture a value whihc doesn't correspond to a field value in SF:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_inputText.htm?search_text=inputtext

All Answers

SonamSonam (Salesforce Developers) 
Looking at the usage of the tags, this code looks correct and should give 3 columns each for the pageBlockSectionItem.What is the exact issue you are facing? Are the columns not appearing correctly?
Frank TimmonsFrank Timmons
I click "Save" and I get this error:

Error: <apex:inputField> (under <apex:page>) must occur between <apex:form></apex:form> tags.
Frank TimmonsFrank Timmons
And I'm not exactly sure how to add this VF Page to the Account Page Layout?
Frank TimmonsFrank Timmons
I actually want the "input field" to be a custom field I've created on the Account object.  Or, because I'm using VF to create the view, do I also have to create the fields here as well?  
SonamSonam (Salesforce Developers) 
Include the page in form tags:
<apex:page>
<apex:form>
<apex:pageBlockSection title="Labor Breakdown" columns="3">
              
<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Estimate1</apex:outputLabel>
<apex:inputField value="{!obj__c.Estimate__c}" style="width:80px"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Hours1</apex:outputLabel>
<apex:inputField value="{!obj__c.Hours__c}" style="width:80px"/>
</apex:pageBlockSectionItem>
          
<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Rate1</apex:outputLabel>
<apex:inputField value="{!obj__c.Rate__c}" style="width:80px"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:form>
</apex:page>
SonamSonam (Salesforce Developers) 
Steps on how to embed a VF page on a standard page layout is explained in the link below:
https://help.salesforce.com/apex/HTViewSolution?id=000005105&language=en_US
You should use inputtext to capture a value whihc doesn't correspond to a field value in SF:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_inputText.htm?search_text=inputtext
This was selected as the best answer
Frank TimmonsFrank Timmons
I did more research and found slightly different code which I then translatd into my own objects and fields.


<apex:page standardController="Account">
   <apex:form >
      <apex:pageBlock title="District Modules"> 
           <apex:pageBlockSection title="My Section" columns="3" collapsible="true">
                <apex:outputField value="{!Account.moduleActive_504__c}"/>
                <apex:outputField value="{!Account.modulePO_504__c}"/>
                <apex:outputField value="{!Account.moduleActive_Cafeteria__c}"/>
                <apex:outputField value="{!Account.modulePO_Cafeteria__c}"/>
                <apex:outputField value="{!Account.moduleActive_Gradebook__c}"/>
                <apex:outputField value="{!Account.modulePO_Gradebook__c}"/>
                <apex:outputField value="{!Account.moduleActive_IRS__c}"/>
                <apex:outputField value="{!Account.modulePO_IRS__c}"/>
              </apex:pageBlockSection> 
         </apex:pageBlock> 
  </apex:form>
</apex:page>
Frank TimmonsFrank Timmons
Would you know how to control the column widths?  I'm thinking it would be within the <apex:pageBlockSection> line?