+ Start a Discussion
Karthikeyan ChandranKarthikeyan Chandran 

Dropdown List from help.

Hi,

I have a multiselect picklist called "Group__c" in User object, i need to display the picklist values as dropdown in a VF page.

How can i fix this?

Can you help me to fix this ASAP?

Thanks
 
Harish RamachandruniHarish Ramachandruni
Hi,

 
<apex:selectList id="countries" value="{!User.Group__c}"
         size="1" required="true">
  <apex:selectOptions value="{!countries}"/>
</apex:selectList>


 
public List<SelectOption> getCountries()
{
  List<SelectOption> options = new List<SelectOption>();
        
   Schema.DescribeFieldResult fieldResult =
 User.Group__c.getDescribe();
   List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
   for( Schema.PicklistEntry f : ple)
   {
      options.add(new SelectOption(f.getLabel(), f.getValue()));
   }       
   return options;
}



Regards,
Harish R