I have a custom object(survey__c) and custom field which holds the picklists values of the month (month__c). i want to use these picklist values in vf page.... i am using a custom controller in vf page .....can anyone help in resolving this issue with an example .

vf page :

<apex:selectList id="Months" value="{!Survey__c.Month__c}" size="1" required="true">
    <apex:selectOptions value="{!months}"/>        

controller :

public List<SelectOption> getMonths()


  List<SelectOption> options = new List<SelectOption>();

   Schema.DescribeFieldResult fieldResult =  Survey__c.Month__c.getDescribe();

   List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();

   for( Schema.PicklistEntry f : ple)


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


   return options;


it is giving error as -

Unknown property : 'CommunitySurveyContrller.Survey__c'

  • post your controller code and vf page. it's hard to guess what's causing your error – pnoytechie Sep 23 '15 at 4:53
  • edited the code – anjali priya Sep 23 '15 at 4:55
  • are you using standardcontroller? – pnoytechie Sep 23 '15 at 4:55
  • i am using a custom controller "CommunitySurveyContrller" – anjali priya Sep 23 '15 at 4:56
  • I think there is not variable defined (with get;set;) as Survey__c, which of-course you cannot define because identifiers cannot contain __. So I think your binding property is incorrect. You need to define a variable in your code and bind the selectlist to that – manjit5190 Sep 23 '15 at 4:57

Assuming Survey__c is what you are trying to populate, you need to define a variable/property in your controller, i.e.:

public Survey__c survey {get; set;}

then in your constructor, instantiate it, i.e.:

public CommunitySurveyContrller() { survey = new Survey__c(); }

then in your VF page, access/connect it, i.e.:

<apex:selectList id="Months" value="{!survey.Month__c}" size="1" required="true"> <apex:selectOptions value="{!months}"/> </apex:selectList>

hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.