While working on a Visualforce page that would automatically show/hide parts of its content I've stumbled upon problems with actionSupport. So the following code doesn't work (to be precise - the "details" pageBlock is not rerendered upon change in the select element):
After googling a bit I've stumbled upon posts suggesting that this happens if you try to rerender pageBlock (or in general - any element) that has the rendered property set. So to make this work you need to wrap your pageBlock with for example outputPanel that will be the one that your actionSupport will rerender. Like below:
<apex:pageBlock>
<apex:form>
<apex:selectList value="{! selectedApplication}" size="1">
<apex:actionSupport event="onchange" reRender="details"/>
<apex:selectOptions value="{! availableApplications}"></apex:selectOptions>
</apex:selectList>
</apex:form>
</apex:pageBlock>
<apex:pageBlock id ="details" title="Details for {! selectedApplication}" rendered="{! NOT(ISNULL(selectedApplication))}">
</apex:pageBlock>
After googling a bit I've stumbled upon posts suggesting that this happens if you try to rerender pageBlock (or in general - any element) that has the rendered property set. So to make this work you need to wrap your pageBlock with for example outputPanel that will be the one that your actionSupport will rerender. Like below:
<apex:pageBlock>
<apex:form>
<apex:selectList value="{! selectedApplication}" size="1">
<apex:actionSupport event="onchange" reRender="details"/>
<apex:selectOptions value="{! availableApplications}"></apex:selectOptions>
</apex:selectList>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="details">
<apex:outputPanel id="details">
<apex:pageBlock title="Details for {! selectedApplication}" rendered="{! NOT(ISNULL(selectedApplication))}">
</apex:pageBlock>
</apex:outputPanel>
</apex:outputPanel>
Comments
Post a Comment