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
Jagadeesh AdaveniJagadeesh Adaveni 

Could you please help me it is urgent requirement. Problem with Picklist values

I have Location and student objects are there. In Location object multiselect picklist paymentmode is there with values(ACH,Check,Cash) and student is lookup to location and even in Student i have picklist called paymentmode with values(ACH,Check,Cash).
 Requirement is Whatever the values i selected in Location only those values should appear in student. I tried following code but it is not working
<apex:inputField value="{!Student__c.Payment_Mode__c}">
                  <apex:actionSupport event="onchange" action="{!picklistFunction}"/>

    public PageReference picklistFunction()
        List<Student__c> studentList = new List<Student__c>();
        List<Student__c> stuList = [select id,name,Payment_mode__c,Location__c,Location__r.Payment_mode__c from Student__c];
        for(Student__c st : stuList)
            st.payment_mode__c = st.Location__r.Payment_Mode__c;
           update studentList;
        return null;

Waqar Hussain SFWaqar Hussain SF
<apex:actionSupport event="onchange" reRender="Id_of_your_pageBlock"/>

Shaijan ThomasShaijan Thomas
public class PicklistDependancy {
	public PageReference SingleSelectPicklistAction() {
		SingleSelectPicklist.add(new SelectOption('None','--None--'));
		for (string MS : MultiSelect){
			SingleSelectPicklist.add(new SelectOption(MS,MS));  
		return null;
	public list<SelectOption> SingleSelectPicklist { get; set; }
	public String SingleSelect { get; set; }
	public list<SelectOption> MultiSelectPicklist { get; set; }
	public list<String> MultiSelect { get; set; }
	public PicklistDependancy (){
		MultiSelectPicklist = new list<SelectOption>();
		SingleSelectPicklist = new list<SelectOption>();
		MultiSelectPicklist .add(new SelectOption('None','--None--'));    
		MultiSelectPicklist .add(new SelectOption('ACH','ACH'));
		MultiSelectPicklist .add(new SelectOption('Check','Check'));
		MultiSelectPicklist .add(new SelectOption('Cash','Cash'));
<apex:page controller="PicklistDependancy">
  <apex:form >
  <apex:pageBlock id="oppList">
      Multi Select
      <apex:selectList value="{!MultiSelect}" title="MultiSelect" multiselect="true">
        <apex:selectOptions value="{!MultiSelectPicklist}"/>
      <apex:selectList value="{!SingleSelect}" title="Picklist" size="1">
         <apex:selectOptions value="{!SingleSelectPicklist}"/>
   <apex:commandButton action="{!SingleSelectPicklistAction}" value="Click" reRender="oppList"/>

Check whether this will help you. if the Location and Student are different VF, Pass the location value list through URL and get in Student page and split it.