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
jucuzoglujucuzoglu 

How do I group information in columns in VisualForce

I am using a page which calls on the standard controller for my custom object.

 

I am creating a form and I want to control which form fields show up in column one and column two.

 

Right now every other input field in my page block switchs columns (i.e. Left Col, Then Right Col, Then Left Col)

 

I tried to use a Table calling my custom object but it did not work (perhaps because the custom object represents a single record and not a related list of records)

 

How should I go about this?

Best Answer chosen by Admin (Salesforce Developers) 
mtbclimbermtbclimber

If you are using apex:pageBlockSection to layout the fields this is the expected behavior and the best recommendation here is to just order the fields in the manner that puts them in the columns you want based on the layout behavior. If you need spacers you can insert apex:pageBlockSectionItem components in the appropriate spots, if for example your second column has more fields than the first. 

 

Otherwise you can certainly construct your own table manually (raw html) and you could even use a component with two string array typed attributes and leverage dynamic binding to make this reusable.