function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SidharthSidharth 

Dependency Picklist Rerender Issues

Hello,

Account_Review__c has three picklist fields, and there are dependency rules defined between them, so options for one field, depends on whats selected in the other.

I am tryign to display the values of these three fields, in a pageblock. But its causing multiple rerenders, because of dependency picklists, and therefore showing wrong results.

Ex. I set values in three fields, and then if i change the first picklist value, the values in second and third picklist shows NULL (per dependency rules) in the dropdown, but doesnt show NULL when i am printing in the page block. See attached images.

What should i do so the values in pageblock, alwasy show the correct picklist values, after rerender. Thanks.
<apex:page standardController="Account_Review__c">

    <apex:form>
        <apex:pageBlock>
            <apex:inputfield value="{!Account_Review__c.Reason__c}" id="f1">
                <apex:actionSupport event="onchange" reRender="Block1"/>
            </apex:inputField>
            <apex:inputfield value="{!Account_Review__c.Result__c}" id="f2">
                <apex:actionSupport event="onchange" reRender="Block1"/>
            </apex:inputField>
            <apex:inputfield value="{!Account_Review__c.Action__c}" id="f3">
                <apex:actionSupport event="onchange" reRender="Block1"/>
            </apex:inputField>
        </apex:pageBlock>
        
        <apex:pageBlock id="Block1">
            <apex:outputLabel >{!Account_Review__c.Reason__c}</apex:outputLabel><BR/>
            <apex:outputLabel >{!Account_Review__c.Result__c}</apex:outputLabel><BR/>
            <apex:outputLabel >{!Account_Review__c.Action__c}</apex:outputLabel><BR/>
        </apex:pageBlock>
    </apex:form>

</apex:page>
User-added imageUser-added image
 
Gyanender SinghGyanender Singh
Hi Sidharth,

this is because you are rerendering the whole pageblock in place of the rerendering the whole pageblock just rerender single inputtype field.

Thanks
Gyani
SidharthSidharth
Thanks Gyanender. Do you mean something like below ? It still not working.
<apex:page standardController="Account_Review__c">

    <apex:form>
        <apex:pageBlock>
            <apex:inputfield value="{!Account_Review__c.Reason__c}" id="f1">
                <apex:actionSupport event="onchange" reRender="o1"/>
            </apex:inputField>
            <apex:inputfield value="{!Account_Review__c.Result__c}" id="f2">
                <apex:actionSupport event="onchange" reRender="o2"/>
            </apex:inputField>
            <apex:inputfield value="{!Account_Review__c.Action__c}" id="f3">
                <apex:actionSupport event="onchange" reRender="o3"/>
            </apex:inputField>
        </apex:pageBlock>
        
        <apex:pageBlock id="Block1">
            <apex:outputLabel id="o1">{!Account_Review__c.Reason__c}</apex:outputLabel><BR/>
            <apex:outputLabel id="o2">{!Account_Review__c.Result__c}</apex:outputLabel><BR/>
            <apex:outputLabel id="o3">{!Account_Review__c.Action__c}</apex:outputLabel><BR/>
        </apex:pageBlock>
    </apex:form>

</apex:page>