0

I have an input field:

<apex:inputField id="tabIndex5" value="{!My_Object__c.Some_Field__c}">
    <apex:actionSupport event="onchange" action="{!DoNothing}" rerender="info,subinfo,subinfo2,emailinfo,advancedSettings" />
</apex:inputField>

I then add a pageBlockSection

<apex:pageBlockSection id="advancedSettings" title="{!$Label.advanced_settings}" columns="1" rendered="{!AND(Not(IsBlank(My_Object__c.Some_Field__c)))}">
    <apex:inputField value="{!My_Object__c.Checkbox_Field__c}" />
</apex:pageBlockSection>

This correctly renders on page rerender or page load. But if the field is populated and it renders initially, then I clear the field, nothing happens. That pageBlockSection does not go away like it should with its rerender because Some_Field__c is now empty. Or if it is empty and then gets populated, the pageBlockSection never shows up. How can I get this onchange to actually rerender the pageBlockSection correctly?

1 Answer 1

2

You can't rerender an element with the specific ID if it has rendered attribute. Add one more outer apex:outputPanel and rerender it instead.

<apex:outputPanel id="advancedSettings">
    <apex:pageBlockSection title="{!$Label.advanced_settings}" columns="1" rendered="{!AND(Not(IsBlank(My_Object__c.Some_Field__c)))}">
        <apex:inputField value="{!My_Object__c.Checkbox_Field__c}" />
    </apex:pageBlockSection>
</apex:outputPanel>
0

You must log in to answer this question.

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