+ Start a Discussion
David HollandDavid Holland 

Conditional Rendering not working on PageBlockSection

Hi all.

 

Below is a snippet from my page.

 

<apex:pageBlockSection title="Freehold Inspection Information" id="Freehold" rendered="{!pageCount=5}">
<apex:pageBlockSectionItem >
<apex:outputText > Inspected As Freehold </apex:outputText>
<apex:actionRegion >
<apex:inputField value="{!Transaction__c.Inspected_As_Freehold__c}">
<apex:actionSupport reRender="FHExpecSection" event="onchange"/>
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection id="FHExpecSection" rendered="{!pageCount=5 && Transaction__c.Inspected_As_Freehold__c=True}">
<apex:inputField value="{!Transaction__c.Inspection_FH_C_C_Expected_Realisation__c}" required="{!Transaction__c.Inspected_As_Freehold__c=True}" />
<apex:inputField value="{!Transaction__c.Inspection_FH_Vendor_Expectation__c}" required="{!Transaction__c.Inspected_As_Freehold__c=True}" />
<apex:inputField value="{!Transaction__c.Inspection_FH_C_C_Asking_Price__c}" required="{!Transaction__c.Inspected_As_Freehold__c=True}" />
</apex:pageBlockSection>

 

The problem is, that FHExpecSection is not rerendering when the checkbox is ticked. I have no idea why, when the exact same formula works if I attach it to each seperate input field. 

 

Anyone have any ideas why this is not working?!

bob_buzzardbob_buzzard

The issue here is that you are trying to rerender something that wasn't present on the page when it was first rendered.  If you put the condition on the fields rather than the pageblocksection, that will work because the pageblocksection is always present even though the individual fields may not be.

 

I've explained this in detail at:

 

http://bobbuzzard.blogspot.co.uk/2011/02/visualforce-re-rendering-woes.html