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
Suresh Kumar 34Suresh Kumar 34 

Display field values in drop down after selecting the field.

Hi Guys,

I have 3 picklist fields called object,field,avnd value.Here after selecting the field i want to display the field values in dropdown.

please find the screenshot.User-added image
please help me out from this.
Nitin SharmaNitin Sharma
Hi Suresh,

Use apex code for this functionality. Change in below code according to your field value.
 
public List<SelectOption> regions
{
    get
    {
        List<SelectOption> options = new List<SelectOption>();
        Schema.DescribeFieldResult fieldResult = Project__c.Division__c.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();

        for( Schema.PicklistEntry f : ple)
            options.add(new SelectOption(f.getLabel(), f.getValue()));
        return options;
    }
}

Use in Vf page below code
<apex:selectList >
        <apex:selectOptions value="{!options}"/>
    </apex:selectList>

Thanks,
Nitin Sharma