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
sfg1sfg1 

display mulitiselect field dynamically onchanging another Picklist field

I have Picklist field "Chart_Flex_Field_1_Datatype__c" with values 'Test1', 'Test2', 'Test3' and 'Test4'. When I select 'Test3', dynamically Multi-select Picklist field (Chart_Flex_Picklist_1__c) should display under "Chart_Flex_Field_1_Datatype__c" field. Please find my code.

<apex:outputField value="{!Project2__c.Chart_Flex_Field_1_Datatype__c}"> 
                        <apex:actionSupport event="onchange" rerender="t1" />
                    </apex:outputField>                    
 <apex:outputField value="{!Project2__c.Chart_Flex_Picklist_1__c}" rendered="{!IF(Project2__c.Chart_Flex_Field_1_Datatype__c == 'Test3', true, false )}" >
 <apex:actionSupport event="onchange" rerender="t1" />
 </apex:outputField>
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.

Visualforce:
<apex:page standardController="Project2__c" >
    <apex:form >
        <apex:pageBlock > 
            <apex:inputField value="{!Project2__c.Chart_Flex_Field_1_Datatype__c}">
                <apex:actionSupport event="onchange" rerender="out1"/>
            </apex:inputField>      
            <br/><br/>
            <apex:pageBlockSection id="out1" >
                <apex:outputPanel rendered="{!IF(Project2__c.Chart_Flex_Field_1_Datatype__c== 'Test3' && Project2__c.Chart_Flex_Field_1_Datatype__c!= 'None', true , false)}">                    
                    <apex:outputLabel value="Multi Picklist" /><br/>                  
                    <apex:inputField value="{!Project2__c.Chart_Flex_Picklist_1__c}" />               
                </apex:outputPanel>
            </apex:pageBlockSection>       
        </apex:pageBlock>
    </apex:form>
</apex:page>

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas
sfg1sfg1
Thanks for your reply. Sorry for replying late. You have implemened the logic on input field, but I need to implement on output field. I tried by changing it to output field but it is not supporting. Can you please help on these. Thanks in Advance.