+ Start a Discussion

Fields auto arrange

Hi Folks,

In VF page, some fields we need to show on right hand and some of them need to show on left hand side. But based on some conditions we are show/hiding some fields then we are getting 2 or 3 spaces/blank lines between the fields. we are using pageblock section items in pagebolck section. any suggestions ...

srlawr uksrlawr uk
If you are using the rendered flag to control the condition of them displaying, you could just inversly display an empty outputpanel in the place of a "missing" element each time, like so:
<apex:outputfield value="{!name}" rendered="{!showName}" />
<apex:outputPanel rendered="{! !showName" />

<apex:outputfield value="{!phone}" />

with something like that, the phone will always appear on the right, as either the name or the blank will appear in the left hand column.

(ah, sorry, this still works fine with pageblocksectionitems, I just forget them in the snippet!)