0

I have two fields in my visual force page and I'm using the value of one field to render the other. The problem is that since I'm using output panel, the formatting of the label is not similar to a inputfield label. The label appears as plain text. I do not wish to use jquery, is there another way around this? Here is the VF page code:

<apex:pageBlockSection>
     <apex:outputPanel id="errorEmailInput">
     <apex:pageBlockSectionItem rendered="{!settings.isEnabled__c == True}">
     <apex:outputLabel value="{!$ObjectType.Settings__c.fields.UserEmail__c.label}" for="errorNotify" rendered="{!settings.isEnabled__c == True}"/>
     <apex:inputfield id="errorNotify" value="{!settings.UserEmail__c}"/>
     </apex:pageBlockSectionItem>
     </apex:outputPanel>
</apex:pageBlockSection>
  • 2
    Why not just put the id on the <apex:pageBlockSection> and render that? Then you can still have <apex:pageBlockSectionItem> as a direct child. – Adrian Larson Mar 31 '17 at 22:30
  • There are other fields(pageblocksectionitem) also part of the pageblocksection hence I have this pageblocksectionitem wrapped with an output panel. For simplicity, I had removed them out of the question context. – Brian Mar 31 '17 at 22:42
  • Point still stands, just rerender the whole section. – Adrian Larson Mar 31 '17 at 22:46
  • ah I see what you are saying. Makes sense. Ideally would have just wanted the pageblocksectionitem to get rerendered. But this works as well. Thank you so much! – Brian Mar 31 '17 at 22:52
2

Just rerender the whole section:

<apex:pageBlockSection id="someId">
    <!-- additional markup -->

    <apex:pageBlockSectionItem rendered="{!...}">
        <!-- additional markup -->
    </apex:pageBlockSectionItem>

    <!-- additional markup -->
</apex:pageBlockSection>

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.