I have a page that is trying to re-render a certain area of the page when a picklist (ndaDetails.NDA_Type__c) is changed. The picklist itself is a part of the pageBlockSection that is supposed to be re-rendered. Upon re-render, other input fields should be rendered depending on the value that was selected for the picklist.
The problem is that when I try to select a value in the picklist, it just changes back to the default value, "--None--", so I lose the value I selected AND the section doesn't re-render appropriately.
I thought the action region would take care of this, but perhaps there is something going on with the value not being sent to the controller in time for it to be saved? If so, how do I force that to happen?
VF Page:
<apex:pageBlockSection columns="1" id="toRerender">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Test Label"/>
<apex:actionRegion >
<apex:inputField value="{!ndaDetails.NDA_Type__c}" required="true">
<apex:actionSupport event="onchange" reRender="toRerender"/>
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
<apex:outputLabel rendered="{!OR(ndaDetails.NDA_Type__c == 'discloses',
ndaDetails.NDA_Type__c == 'mutual')}">
Test output label
</apex:outputLabel>
<apex:inputField value="{!ndaDetails.Data_Classification__c}"
rendered="{!OR(ndaDetails.NDA_Type__c == 'disclose',
ndaDetails.NDA_Type__c == 'mutual')}"/>
<apex:inputField value="{!ndaDetails.Personal_Information_Released__c}"
rendered="{!AND(OR(ndaDetails.Data_Classification__c == 'confidential',
ndaDetails.Data_Classification__c == 'restricted'),
OR(ndaDetails.NDA_Type__c == 'disclose',
ndaDetails.NDA_Type__c == 'mutual'))}"/>
</apex:pageBlockSection>
Controller:
public NDA_Details__c ndaDetails = new NDA_Details__c();
public NDA_Details__C getNdaDetails() {
return ndaDetails;
}
Thanks in advance!