+ Start a Discussion

Help with Multiselect picklist in controller code

Can I do this for a multiselect picklist?


 public List<SelectOption> getOptions(){

List<SelectOption> options = new List<SelectOption>();Schema.DescribeFieldResult goLive = Schema.sObjectType.


for (Schema.PickListEntry glpPickVal : goLive.getPicklistValues()){

// create a selectoption for each pickval

options.add(new SelectOption(glpPickVal.getValue(),glpPickVal.getLabel()));


return options;


I use this same code but for a differnt object on a regular selectlist and it works perfectly.

Here is how i want to make use of it in a visualforce page:


<apex:pageBlockSectionItem >

<apex:outputLabel value="Go Live Processes" />

<apex:selectList value="{!Go_Live_Process__c.Go_Live_Processes__c}" size="9">

<apex:selectOptions value="{!getOptions}" />

<apex:actionSupport reRender="TheBlock" event="onchange" status="showCredentialing" />





I get this error when I run a build:

it is an error for that visualforce block stating it does not know the property getOptions. I do not get this error when I do this with a regular picklist.


Save error: Unknown property 'Go_Live_Process__cStandardController.getOptions' GoLiveEdit.page Dev1 Sandbox/src/pages line 0 Force.com save problem


Any suggestions? I am trying to use this multiselect picklist with action support for specific pageblocksections to display based on which options are selected from the multiselect picklist.





  <apex:selectOptions value="{!Options}" />


Instead of


<apex:selectOptions value="{!getOptions}" />