function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Esther MercEsther Merc 

Visualforce Picklist Values from Custom Object not showing

Hi Guys,

I have this page  which is showing no error in code but the Security Question picklist values is not showing the options from the custom Registration__c  object field named Security Questions which is a picklist.
Can you please help me.          Below is VF and Controller Class



VF
<apex:page Controller="NewRegistration"  sidebar="false"   showHeader="false">
<apex:sectionHeader title="Registration Page"/>
<apex:form >
<apex:pageBlock id="pg1" >
  <apex:pageMessages />
    <apex:pageBlockSection columns="1">
        <apex:inputText label="Name" value="{!reg.name}"/>
        <apex:inputText label="Username" value="{!reg.Username__c}"/>
        <apex:inputSecret label="Password" value="{!reg.Password__c}"/>
        <apex:inputSecret label="Confirm Password" value="{!reg.Confirm_Password__c}"/>
        <apex:selectlist label="Security Question" value="{!reg.Security_Question__c}"/>
        <apex:inputText label="Security Answer" value="{!reg.Security_Answer__c}"/>       
    </apex:pageBlockSection>
    <apex:pageBlockButtons >       
          <apex:commandButton value="Submit" action="!saveAction" reRender="pg1" />
    </apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>


Controller Class
public class NewRegistration {

  Public Registration__c  reg {get ; set;}
 
  public NewRegistration(){
         reg = new Registration__c ();
     }    
     
    public void saveAction(){
      system.debug ('saveAction inside' +reg);  
       
        insert reg;
        if (reg.name !=null) {        
        Apexpages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Registration Saved Successfully'));
     }
     
}
}



 
Best Answer chosen by Esther Merc
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Can you check the below article which shows the same behaviour.

https://wedgecommerce.com/fetch-picklist-value-of-standard-or-custom-picklist-field/

If this solution helps, Please mark it as best best answer.

Thanks,