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
Raji_forceRaji_force 

How to get selected value from multiselect picklist to controller

<apex:form >
        <apex:actionRegion >
            <apex:selectList value="{!objClass.Class_Meets__c}" multiselect="true">
                <apex:selectOptions value="{!items}"/>
            </apex:selectList>
            
            <apex:inputField value="{!objClass.Class_Meets__c}">
                <apex:actionSupport event="onchange" action="{!showPanel}" rerender="panel">
                    <apex:param value="{!objClass.Class_Meets__c}" name="classmeets" assignTo="{!classmeets}"/>
                </apex:actionSupport>
            </apex:inputField>    
        </apex:actionRegion>
        
         <apex:outputPanel id="panel">
         <apex:outputPanel rendered="{!flag}">
                   {!objClass.Class_Meets__c}
                   {!classmeets}
            </apex:outputPanel>
        </apex:outputPanel>
    </apex:form>

where "classmeets" is string. I am not able to get the currently selected picklist value in controller.  {!objClass.Class_Meets__c} displays the selected values but "classmeets" come null. 

Best Answer chosen by Raji_force
Ajay Ghuge 6Ajay Ghuge 6
Hi ,

You cannot modify the same inputfield again. You need to built custom selectlist and custom button. Using the index and some custom logic it can be possible.

Regards,
Ajay 

All Answers

Ajay Ghuge 6Ajay Ghuge 6
Hi ,
Can you provide more details about the problem ? 

Why you have included first selectlist in action region ? Can you take it out if not required ?

Regards,
Ajay
Raji_forceRaji_force

Hi, 
Thank you for the response. Your suggestion helped me :)

I would like to know if we can get the currently selected pcklist value (in Multiselect picklist). Above code gives all previously selected values also but I want only newly selected value. 

Thank you. 

 

Ajay Ghuge 6Ajay Ghuge 6
Hi ,

You cannot modify the same inputfield again. You need to built custom selectlist and custom button. Using the index and some custom logic it can be possible.

Regards,
Ajay 
This was selected as the best answer