You need to sign in to do that
Don't have an account?
robert webber 8
Multiselect list not working
I'm trying to create a simple multiselect list using the example in the developer guide. There are no checkboxes displayed. I just get a list of the select options but can't select anything. If I click on any value, it is highlighted, but only one at a time.
My VF and controller are below. Help anyone? It seems this should be simple. Have spent several hours trying to get it to work.
<apex:page standardController="Planning_Object__c" extensions="PlanningObjectControllerExt" LightningStyleSheets="True">
<apex:form >
<apex:selectList multiselect="true" value="{!SelectedTypeOptions}" label="Object Type">
<apex:selectOptions value="{!Types}"/>
</apex:selectList>
</apex:form>
</apex:page>
Controller:
public with sharing class PlanningObjectControllerExt {
public List<SelectOption> PLOptions = new List<SelectOption>();
public String SelectedPL{get;set;}
public List<SelectOption> planningOptionTypes = new List<SelectOption>();
String[] selectedTypeOptions = new String[]{};
public ApexPages.StandardController controller;
ID objectID = System.currentPagereference().getParameters().get('ID');
//constructor
public PlanningObjectControllerExt(ApexPages.StandardController standardController) {
this.controller = controller;
Schema.DescribeFieldResult fieldResult = Planning_Object__c.Type__c.getDescribe();
List<Schema.PicklistEntry> options = fieldResult.getPickListValues();
for(Schema.PicklistEntry s:options) {
planningOptionTypes.add(new SelectOption(s.getLabel(),s.getValue()));
}
} //end controller
public List<SelectOption> getTypes() {
return planningOptionTypes;
}
public String[] getSelectedTypeOptions() {
return selectedTypeOptions;
}
public void setSelectedTypeOptions(String[] selectedTypeOptions) {
this.selectedTypeOptions = selectedTypeOptions;
}
}
My VF and controller are below. Help anyone? It seems this should be simple. Have spent several hours trying to get it to work.
<apex:page standardController="Planning_Object__c" extensions="PlanningObjectControllerExt" LightningStyleSheets="True">
<apex:form >
<apex:selectList multiselect="true" value="{!SelectedTypeOptions}" label="Object Type">
<apex:selectOptions value="{!Types}"/>
</apex:selectList>
</apex:form>
</apex:page>
Controller:
public with sharing class PlanningObjectControllerExt {
public List<SelectOption> PLOptions = new List<SelectOption>();
public String SelectedPL{get;set;}
public List<SelectOption> planningOptionTypes = new List<SelectOption>();
String[] selectedTypeOptions = new String[]{};
public ApexPages.StandardController controller;
ID objectID = System.currentPagereference().getParameters().get('ID');
//constructor
public PlanningObjectControllerExt(ApexPages.StandardController standardController) {
this.controller = controller;
Schema.DescribeFieldResult fieldResult = Planning_Object__c.Type__c.getDescribe();
List<Schema.PicklistEntry> options = fieldResult.getPickListValues();
for(Schema.PicklistEntry s:options) {
planningOptionTypes.add(new SelectOption(s.getLabel(),s.getValue()));
}
} //end controller
public List<SelectOption> getTypes() {
return planningOptionTypes;
}
public String[] getSelectedTypeOptions() {
return selectedTypeOptions;
}
public void setSelectedTypeOptions(String[] selectedTypeOptions) {
this.selectedTypeOptions = selectedTypeOptions;
}
}
Multiselect doesn't have checkboxes you need to hold Ctrl and select options from the display list.
Cheers!!!