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
Big developersBig developers 

Getting Custom Picklist Values

Before I begin, let me say that we're trying to avoid using JavaScript at all costs. We'd really like JavaScript to just be a last resort.

 

So, I have the following bit of code within a wrapper class in VisualForce:

 

                        <apex:selectList size="1">
                               <apex:selectOptions value="{!cond.PicklistValues}"/>
                        </apex:selectList>

 

PicklistValues is a function that returns a custom select list ( SelectOption[] ) for each object. The select list is different depending on one of the settings of the object.

 

Now, here's the question... How do I read off what the Picklist is set to in Apex? when the user hits save, I want to map their Picklist selection to an actual attribute.

 

Thanks for all the help!

Best Answer chosen by Admin (Salesforce Developers) 
Jeremy.NottinghJeremy.Nottingh

selectlist takes a value= attribute. 

 

 

<apex:selectList value="{!cond.ChosenValue}" size="1">
                               <apex:selectOptions value="{!cond.PicklistValues}"/>
                        </apex:selectList>

 Your wrapper class should have a String attribute that will hold this value.

 

Jeremy