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
John McGlinnJohn McGlinn 

Visualforce how can assign Fields to Column 1 or 2?

Here's an example of a section I'm replicating in Visualforce. I feel like I've travelled the Seven Kingdoms trying to find an answer to this question. Visualforce will evenly distribute the fields between two columns; however, the client would like it to replicate the native page layout, and that means certain fields exist in a certain order and in specific columns. I've tried Style attributes but they only seem to effect the formatting of the field itself and not which column to associate said field. 

<apex:pageBlockSection title="Special Request Tracking" columns="2" rendered="{!Case.Request_Type2__c== 'Special Requests'}">
                   <apex:inputField value="{!Case.Origin}"/>
                   <apex:inputField value="{!Case.ServicingData__c}"/>
                   <apex:inputField value="{!Case.Type_of_Communication__c}"/>
                   <apex:inputText value="{!Case.Contact}"/>
                   <apex:inputField value="{!Case.Requestor_Role__c}"/>
                   <apex:inputField value="{!Case.Exclude_from_CPI_Reporting__c}"/>
             </apex:pageBlockSection>

Any help would be greatly appreciated!
Best Answer chosen by John McGlinn
JayantJayant
For blank space, simply put <apex:pageBlockSectionItem/> i.e. an empty section item and you are done. This would replicate the empty space functionality of standard page layouts.

If this resolves your problem, please mark the question as resolved.

All Answers

Sagar PareekSagar Pareek
Have you tried creating a field set ? 
Your problem should solve using field sets.
https://www.salesforce.com/docs/developer/pages/Content/pages_dynamic_vf_field_sets.htm
John McGlinnJohn McGlinn
Thanks for the response. Field Sets unfortunately had the same attribute when it came to formatting. They stacked on top of each other and where evenly distrbuted between the two columns in my use case.

I didn't see anything about styles or formatting when it came to Field Sets as well
JayantJayant
For blank space, simply put <apex:pageBlockSectionItem/> i.e. an empty section item and you are done. This would replicate the empty space functionality of standard page layouts.

If this resolves your problem, please mark the question as resolved.
This was selected as the best answer
John McGlinnJohn McGlinn
Thank you Jayant. That was a good idea and solves my issue. Always the simplest solutions work out in the end.