1

I have a visualforce page which has a couple page block sections (under pageblock > form), and is meant to have inputs within those sections. For some reason, the input fields will appear in the first pageblocksection but not the second.

    <apex:page controller="RecurringEvents_Controller">
<apex:form ><apex:pageBlock >
    <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!Save}"/>
        <apex:commandButton value="Delete" action="{!Delete_x}"/>
        <apex:commandButton value="Toggle Active Status" action="{!toggleActive}"/>

        <apex:outputPanel >Current Event Recurrence: &nbsp;
            <apex:selectList value="{!EventRecurrenceID}" multiselect="false" size="1">
                <apex:selectOptions value="{!eventList}"/>
                <apex:actionSupport event="onchange" action="{!reload}"/>
            </apex:selectList></apex:outputPanel>
    </apex:pageBlockButtons>

    <apex:pageMessages />

    <apex:pageBlockSection title="Event Information">
        <apex:inputField value="{!eventRecurrence.name}"/>

        <apex:outputField value="{!eventRecurrence.Active__c}" />

    </apex:pageBlockSection>

    <apex:pageBlockSection title="Recurrence Information" columns="2">


        <apex:pageBlockSectionItem dataStyle="width:1%" labelStyle="width:1%" >
            <apex:selectRadio layout="pageDirection">
                <apex:selectOption itemvalue="1"/>
                <apex:selectOption itemvalue="2"/>
            </apex:selectRadio>
        </apex:pageblocksectionitem>
        <apex:pageBlockSectionItem dataStyle="padding:15px">
            <inputField value="{!eventRecurrence.name}"/>
            On day 
            <inputField value="{!eventRecurrence.Day__c}"/> 
            of every 
            <inputField value="{!eventRecurrence.Number_of_Months__c}"/> 
            month(s)
            <br/>


        </apex:pageblocksectionitem>
    </apex:pageBlockSection>
</apex:pageBlock></apex:form>

When I run the page I get this out incorrectly rendered So the question is, have I gone insane, or has Salesforce? What is causing the second pageblocksection to omit the input fields?

FYI I've tried removing all code in the second page block section except for a single inputfield for the name of the event recurrence object, removed the columns declaration, everything. Still doesn't render anything. So even if I make the second page block section the same as the first, it still fails to render correctly.

Edit: added a more explicit question.

Furthermore, when I inspect the rendered page, the areas where the inputfields should be there are indeed input tags, however the values are blanks.

All of the fields in the inputfields are being grabbed by SOQL in the controller, and the variable eventRecurrence is a public variable.

6
  • did you try by removing this styling on the pageblocksection if they appear at right places? dataStyle="width:1%" labelStyle="width:1%" – Rao Oct 28 '16 at 20:04
  • do you have permission to those inputFields? – Santanu Boral Oct 28 '16 at 20:05
  • Yeah, I removed the whole pageblocksectionitem with the radio buttons, even the other inputs, leaving only one input for the Name, with no change in behavior. – user28144 Oct 28 '16 at 20:09
  • I do have permission, as you can see the Name and Active fields are rendering admirably' – user28144 Oct 28 '16 at 20:09
  • can you paste the complete vf page? are there any other stylesheets that you are loading into the page – Rao Oct 28 '16 at 20:23
1

You have missed the apex: namespace in your inputfield here, also you are wrapping more than 2 child elements inside the pageblocksectionitem. once you add the apex: namespace the page may complaint that you have more than 2 child elements, which you may have to resolve by removing the apex:pageblocksectionitem wrapping the 3 fields (or) split them into 2 apex:pageblocksectionitem to render the 3 input fields.

Change this from:

<inputField value="{!eventRecurrence.name}"/>
            On day 
            <inputField value="{!eventRecurrence.Day__c}"/> 
            of every 
            <inputField value="{!eventRecurrence.Number_of_Months__c}"/> 
            month(s)

To:

<apex:inputField value="{!eventRecurrence.name}"/>
                On day 
                <apex:inputField value="{!eventRecurrence.Day__c}"/> 
                of every 
                <apex:inputField value="{!eventRecurrence.Number_of_Months__c}"/> 
                month(s)
4
  • Thank you! Sometimes all it takes is someone over your shoulder I suppose. – user28144 Oct 28 '16 at 20:43
  • 1
    Blame it on friday and move on :D – Rao Oct 28 '16 at 20:44
  • To be technical, it's not a "tag", it's a "namespace". Definitely a nice find, though; it's amazing how easy it is to miss something like that. – sfdcfox Oct 28 '16 at 21:11
  • @sfdcfox corrected :) and for my defense, I am blaming it on friday too. – Rao Oct 28 '16 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.