Newer Version Available
Best Practices for Page Block Components
- Adding More than Two Child Components to <apex:pageBlockSectionItem>
- An <apex:pageBlockSectionItem> component can only have up to two child components. Sometimes, though,
you want to add an extra child component. For example, you may want
to add an asterisk before an <apex:outputLabel> and still display the associated input text field. You can do this
by wrapping the asterisk and output label in an <apex:outputPanel> component,
as follows:
1<!-- Page: --> 2<apex:page standardController="Account"> 3 <apex:form > 4 <apex:pageBlock title="My Content" mode="edit"> 5 <apex:pageBlockSection title="My Content Section" columns="2"> 6 <apex:pageBlockSectionItem > 7 <apex:outputPanel> 8 <apex:outputText>*</apex:outputText> 9 <apex:outputLabel value="Account Name" for="account__name"/> 10 </apex:outputPanel> 11 <apex:inputText value="{!account.name}" id="account__name"/> 12 </apex:pageBlockSectionItem> 13 </apex:pageBlockSection> 14 </apex:pageBlock> 15 </apex:form> 16</apex:page>