I have one controller and one VF page.I am getting error saying "Unknown property 'Multipicklist.getPicklistValues'" for VF page.Dont know why it is.
Controller:
global class Multipicklist {
global list<SelectOption> picklistValues{get;set;}
SObject Account;
String Dummy='Dummy__c';
global Multipicklist(){
list<SelectOption> picklistValues = new list<SelectOption>();
// Get the object type of the SObject.
Schema.sObjectType objType = Account.getSObjectType();
// Describe the SObject using its object type.
Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
// Get a map of fields for the SObject
map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap();
// Get the list of picklist values for this field.
list<Schema.PicklistEntry> values =
fieldMap.get(Dummy).getDescribe().getPickListValues();
System.debug('value of values :::'+values);
// Add these values to the selectoption list.
for (Schema.PicklistEntry a : values)
{
picklistValues.add(new SelectOption(a.getLabel(), a.getValue()));
System.debug('value of picklist added :::'+picklistValues);
}
}
}
VF Page:
<apex:page controller="Multipicklist" >
<apex:form>
<apex:pageblock>
<apex:selectCheckboxes border="3">
<apex:selectOptions value="{!PicklistValues}"></apex:selectOptions>
</apex:selectCheckboxes>
</apex:pageblock>
</apex:form>
</apex:page>