1

Here is my code, please help me what am I doing wrong

VisualForce page:

<apex:page standardController="Contact" recordSetVar="Contacts" extensions="myContactExtension">
    <apex:form >
        <apex:selectList size="1" multiselect="false"  >
            <apex:selectOptions value="{!getOptions}" />
        </apex:selectList>
    </apex:form>
</apex:page>

Extension Controller:

public class myContactExtension {

    List<Contact> contacts;
    public myContactExtension(ApexPages.StandardSetController controller) {
        contacts = (List<Contact>) controller.getSelected();
    }

    public List<ApexPages.SelectOption> getOptions() {
        List<ApexPages.SelectOption> options = new List<ApexPages.SelectOption>();
        options.add(new ApexPages.SelectOption('','--SELECT--'));

        for(Account_Plan__c p:[select name from account_plan__c order by name asc]) {
            options.add(new ApexPages.SelectOption(p.id, p.name));
        }
        return options;
    }

}

Error:

Error: Unknown property 'ContactStandardController.getOptions'

1

try this <apex:selectOptions value="{!Options}"/> when you use the 'get' apex thinks you are exposing a getter / setter method..

Hence this example.. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_pages_selectoption.htm

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.