I am trying to refresh a page block section based on the value of a select list. Here is the VF:
<apex:pageblockSectionItem >
<apex:selectList size="1" value="{!reasonCode}">
<apex:selectOptions value="{!reasonCodes}"/>
<apex:actionSupport event="onchange" reRender="a"/>
<apex:actionSupport event="oncomplete" action="{!isAcceptedReasonCode}" reRender="orders"/>
</apex:selectList>
</apex:pageblockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection id="orders" rendered="{!isAcceptedRC==true}" >
<apex:outputLabel value="Order Number" for="odNum"/>
<apex:inputText id="odNum" value="{!OrderNumber}"/>
</apex:pageBlockSection>
I have tried a bunch of different events, but none seem to work. Here is the isAcceptedReasonCode function:
public PageReference isAcceptedReasonCode (){
if(reasonCode == 'Accepted Offer') {
isAcceptedRC = true;
}else {
isAcceptedRC = false;
}
return null;
}
This seems pretty straightforward but it doesn't seem to work... of course i change the select list to be = 'Accepted Offer'
Add apex:outputPanel above apex:pageBlockSection and reRender outputpanel when Selection options is changed.
Sample Code:
<apex:pageblockSectionItem >
<apex:selectList size="1" value="{!reasonCode}">
<apex:selectOption itemLabel="Test" itemValue="Test"></apex:selectOption>
<apex:selectOption itemLabel="Accepted Offer" itemValue="Accepted Offer"></apex:selectOption>
<apex:actionSupport event="onchange" action="{!isAcceptedReasonCode}" reRender="testPanel"/>
</apex:selectList>
</apex:pageblockSectionItem >
</apex:pageBlockSection>
<apex:outputPanel id="testPanel">
<apex:pageBlockSection id="orders" rendered="{!isAcceptedRC}" >
<apex:outputLabel value="Order Number" for="odNum"/>
<apex:inputText id="odNum" value="{!OrderNumber}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock >