So - I have a page like this:
<apex:page >
<apex:form >
<apex:pageBlock id="pageBlock">
<apex:pageBlockSection title="Some Text">
<apex:inputField value="{!record.Description__c}" required="true">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Type"/>
<apex:actionRegion >
<apex:inputField value="{!record.Type__c}">
<apex:actionSupport action="{!typeChanged}" rerender="pageBlock" event="onchange"/>
</apex:inputField>
</apex:actionRegion>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!record.Type__c = 'Special Value'}">
<apex:outputLabel value="Other Field"/>
<apex:inputField value="{!record.OtherField__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form >
</apex:page>
Currently the user inputs some information into the first field - Description
. Then the user selects the Type
which will conditionally rerender the whole pageBlock eventually showing or hiding Other Field
based on Type
.
The problem with this is that every time I change the Type
the Description
will be emptied as it is rerendered as part of that operation. Instead of rerendering the whole pageBlock it would be nice if we could just rerender the last pageBlockItem.
I tried a lot but I just can't get it to work. Any advice?