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
vanita kumarivanita kumari 

How to get the selected item from standard multiselect picklist

Hi All,

I am new to slesforce. i have created a stadard object and creating the Visual force page for he same. I have 1 multiselectpicklist and 1 checkbox..On clicking the checkboxt , i want to move one item from unselected  to selected items.

i am not sure how can i access the standard multipicklist selected and unselected item in my visualforce page/controller.

Please have a look on my page.


<apex:page standardController="Batch__c" >
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(document).ready(function(){
alert('testfirst');
$("#studentnoptification").change(function(){ 
alert('test');
$("#isprof").toggle();
});
});
</script>
<apex:form >
<apex:pageBlock>
<apex:pageBlockSection id="pbSection1" columns="1">
<apex:inputfield value="{!Batch__c.Name}" id="Bus" required="true"/>
<apex:inputfield value="{!Batch__c.isstudent__c}" id="studentnoptification"/>
<apex:inputfield value="{!Batch__c.Lab_Timing__c}" required="true"/>  ===> i want to move one item from  unselected list to selected list.  
<apex:inputfield value="{!Batch__c.isproffessional__c}" id="isprof"/> 
</apex:pageBlockSection>
<apex:pageBlockButtons > <apex:commandbutton value="Save" action="{!save}"></apex:commandbutton> <apex:commandbutton value="Save & new" action="{!quicksave}"></apex:commandbutton> <apex:commandbutton value="Cancel" action="{!cancel}"></apex:commandbutton>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>


Thanks in Advance

 
SonamSonam (Salesforce Developers) 
Following is a sample code to use a standard multiselect picklist on contact using statndard controller:

<apex:form >

<apex:pageBlock mode="edit">
<apex:pageBlockSection id="pbSection1" columns="1">
<apex:inputfield value="{!Contact.firstname}" required="true" />
<apex:inputfield value="{!Contact.lastname}" required="true" />

<apex:inputfield value="{!Contact.Pets_liked__c}" required="true" />
</apex:pageBlockSection> // MULTISELECT PICKLIST
<apex:pageBlockButtons > <apex:commandbutton value="Save" action="{!save}"></apex:commandbutton> <apex:commandbutton value="Save & new" action="{!quicksave}"></apex:commandbutton> <apex:commandbutton value="Cancel" action="{!cancel}"></apex:commandbutton>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>