• Hot Rabatt
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi experts!
I have a little problem with a simple force.com site that I'm building.
I want to see a list of contacts with basic info, one of these info is a picklist field, but when I render the page, this picklist show the first value of list instead of the current value of the record.
Here's my VF Code of the picklist:
VF
<apex:pageBlockSectionItem >
                                    <apex:outputLabel value="{!$ObjectType.Contact.fields.type__c.label}" />
                                    <apex:selectList styleClass="slds-input"  value="{!statusOptions}"   size="1">
                                        <apex:selectOptions value="{!ItemsList}" rendered="true"/>
                                    </apex:selectList>
                                </apex:pageBlockSectionItem>
And the method of the controller:

public List<Selectoption> getItemsList(){
        List<SelectOption> options = new List<SelectOption>(); 
        List<Schema.Picklistentry> fieldResult = Schema.Contact.type__c.getDescribe().getPicklistValues();
        //options.add(new SelectOption());
        for(Schema.PicklistEntry f : fieldResult) {
            options.add(new SelectOption(f.getValue(), f.getLabel()));
        }
        return options;
    }

Any help will be very appreciated! Thanks in advance.