+ Start a Discussion
Lago S.p.a.Lago S.p.a. 

Current Picklist of record does not show in visualforce

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:
<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"/>
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.
Dushyant SonwarDushyant Sonwar
<apex:selectList styleClass="slds-input" value="{!statusOptions}" size="1">


<apex:selectList styleClass="slds-input"  value="{!Contact.Type__c}"   size="1">

It will show the contact record type value.
Dushyant SonwarDushyant Sonwar
Also , giving you can give FLS to contact type custom field on site
Hot RabattHot Rabatt
I also making a site like yours. The main things I'm doing is sharing about couponcodes. Visit me https://hotrabatte.com/