+ Start a Discussion

Hardcode apex:selectionoptions?

Hi Everyone


Is it possible to hard-code the options for apex:selectoptions (ie: not call a method in the controller) - I only have a few non-variable options.


Many thanks for any assistance



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

Yes - simply put the appropriate number of <apex:selectOption/> elements inside the selectlist.  From the developer's guide:


<apex:selectList id="chooseColor" value="{!string}" size="1">
  <apex:selectOption itemValue="red" itemLabel="Red"/>
  <apex:selectOption itemValue="white" itemLabel="White"/>
  <apex:selectOption itemValue="blue" itemLabel="Blue"/>