+ Start a Discussion
Sindhu NagabhushanSindhu Nagabhushan 

highlight picklist value

i have the below requirement and i am new to visulaforce. Someone please provide an idea on how to create this.

I want to create a table with all the picklist values available. when i add this VF page to page layout, the corresponding picklist value for that record should be highlighted in my table, Like the image below --
User-added image
Thanks for your help in advance.
Hello Sindhu,

Ty to use following sample code. this is for Lead sObject.

Visualforce Page:
<apex:page standardController="Lead" extensions="extleadPicklistVal">
    <table style="border-collapse: collapse;" border="1">
    <apex:repeat value="{!lstLeadSource}" var="ls">
            <td style="color:{!If(ls == Lead.LeadSource, 'red;','')}">

Apex Class:
public class extleadPicklistVal {
    public List<String> lstLeadSource {get; set;}
    public extleadPicklistVal(ApexPages.StandardController controller) {
        lstLeadSource = new List<String>();
        Schema.DescribeFieldResult fieldResult = Lead.LeadSource.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry f : ple){        

Thank You,
Hitesh Patel
Email :- hiteshpatel.aspl@gmail.com
Sindhu NagabhushanSindhu Nagabhushan
Thank you very much Hitesh.This works fine.

I have to create multiple tables similarly for all picklist fields. Can you help me how to place two tables next to each other?

Thanks in advance.
Sindhu NagabhushanSindhu Nagabhushan
Hi Hitesh,

I am trying to implement your approach for multi-select picklist and its not working. Should we follow a different approach for multi-select picklist?

When i selecy multiple values in my field, values are not getting highlighted.

Thanks in advance