4

I am using a apex:inputField in my vf page. This apex:inputField is in page block with apex:inputField their is also a apex:selectOption, to reduce the space between these 2 fields i put them in a apex:pageBlockSectionItem, now these fields are closer to each other but the label of the field is not get displayed.

My code:

<apex:pageBlockSectionItem>

         <apex:inputField value="{!Event.StartDate_forEvent__c}" required="true" label="Start"> 
            <apex:actionSupport event="onchange" rerender="Event_view" action="{!rerender}">
                <apex:param name="startDate_VF" value="{!Event.StartDate_forEvent__c}" assignTo="{!startDate_VF}"/>
            </apex:actionSupport>
         </apex:inputField>

        <apex:selectList id="chooseStartTime" value="{!startTime_FromVf}" size="1">
            <apex:selectOption itemValue="01:00" itemLabel="01:00"/>
            <apex:selectOption itemValue="01:30" itemLabel="01:30"/>
            <apex:selectOption itemValue="02:00" itemLabel="02:00"/>
            <apex:selectOption itemValue="02:30" itemLabel="02:30"/>
            <apex:selectOption itemValue="03:00" itemLabel="03:00"/>
            <apex:selectOption itemValue="03:30" itemLabel="03:30"/>
            <apex:selectOption itemValue="04:00" itemLabel="04:00"/>
            <apex:selectOption itemValue="04:30" itemLabel="04:30"/>
            <apex:selectOption itemValue="05:00" itemLabel="05:00"/>
            <apex:selectOption itemValue="05:30" itemLabel="05:30"/>
            <apex:selectOption itemValue="06:00" itemLabel="06:00"/>
            <apex:selectOption itemValue="06:30" itemLabel="06:30"/>
            <apex:selectOption itemValue="07:00" itemLabel="07:00"/>
            <apex:selectOption itemValue="07:30" itemLabel="07:30"/>
            <apex:selectOption itemValue="08:00" itemLabel="08:00"/>
            <apex:selectOption itemValue="08:30" itemLabel="08:30"/>
            <apex:selectOption itemValue="09:00" itemLabel="09:00"/>
            <apex:selectOption itemValue="09:30" itemLabel="09:30"/>
            <apex:selectOption itemValue="10:00" itemLabel="10:00"/>
            <apex:selectOption itemValue="10:30" itemLabel="10:30"/>
            <apex:selectOption itemValue="11:00" itemLabel="11:00"/>
            <apex:selectOption itemValue="11:30" itemLabel="11:30"/>
            <apex:selectOption itemValue="12:00" itemLabel="12:00"/>
            <apex:selectOption itemValue="12:30" itemLabel="12:30"/>
            <apex:selectOption itemValue="13:00" itemLabel="13:00"/>
            <apex:selectOption itemValue="13:30" itemLabel="13:30"/>
            <apex:selectOption itemValue="14:00" itemLabel="14:00"/>
            <apex:selectOption itemValue="14:30" itemLabel="14:30"/>
            <apex:selectOption itemValue="15:00" itemLabel="15:00"/>
            <apex:selectOption itemValue="15:30" itemLabel="15:30"/>
            <apex:selectOption itemValue="16:00" itemLabel="16:00"/>
            <apex:selectOption itemValue="16:30" itemLabel="16:30"/>
            <apex:selectOption itemValue="17:00" itemLabel="17:00"/>
            <apex:selectOption itemValue="17:30" itemLabel="17:30"/>
            <apex:selectOption itemValue="18:00" itemLabel="18:00"/>
            <apex:selectOption itemValue="18:30" itemLabel="18:30"/>
            <apex:selectOption itemValue="19:00" itemLabel="19:00"/>
            <apex:selectOption itemValue="19:30" itemLabel="19:30"/>
            <apex:selectOption itemValue="20:00" itemLabel="20:00"/>
            <apex:selectOption itemValue="20:30" itemLabel="20:30"/>
            <apex:selectOption itemValue="21:00" itemLabel="21:00"/>
            <apex:selectOption itemValue="21:30" itemLabel="21:30"/>
            <apex:selectOption itemValue="22:00" itemLabel="22:00"/>
            <apex:selectOption itemValue="22:30" itemLabel="22:30"/>
            <apex:selectOption itemValue="23:00" itemLabel="23:00"/>
            <apex:selectOption itemValue="23:30" itemLabel="23:30"/>
            <apex:selectOption itemValue="00:00" itemLabel="00:00"/>
            <apex:selectOption itemValue="00:30" itemLabel="00:30"/>
            <apex:actionSupport event="onchange" rerender="chooseEndTime" action="{!addDate}">
            </apex:actionSupport>
        </apex:selectList>

        </apex:pageBlockSectionItem> 

Does anybody tell me what need to be done to get the label displayed. i am also using label in apex:inputField.

Edited: I put the outputtext outside the panal. But even then i am getting time and date inputtext in a row i need then in a column.

Now it is look like

enter image description here

2 Answers 2

8

See this documentation link

Note that if you include an <apex:outputField> or an <apex:inputField> component in an <apex:pageBlockSectionItem>, these components do not display with their label or custom help text as they do when they are children of an <apex:pageBlockSectionItem>. Also note that <apex:pageBlockSectionItem> components cannot be rerendered; rerender the child components instead.

Not to worry though! Just do this:

<apex:outputLabel value="[Label value goes here]" for="[inputText's ID goes here]"/>
<apex:inputText value="{![your value goes here]}" id="[inputText's ID goes here]"/> 

Note however that you can only have two items inside a pageBlockSection item, so you may need to rework your page a little

EDIT: On that note, one way to get round the two item limit would be to use

<apex:outputPanel> 

...to bunch items together

2
  • yes i did it before. But the problem with this is it display the field in Row. I need them is a column.
    – AnuRaj
    Commented Mar 11, 2013 at 5:27
  • It will work Anu raj Just give the no of columns in pageblocksection columns attribute.if not working can u just write code here with apex:outputlabel
    – Pankaj
    Commented Mar 11, 2013 at 6:17
3

You can use apex:outputLabel instead

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .