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
HydHyd 

Reg: Un used records from the picklist

Hi,

 

I Created an object country__c.

It has 2 fields. country_name (text field) and city__c(picklist field).

 

I used below code in Controller.

----------

 

 

public class pick2con {
    public pick2con() {
    }
    
    set<String> sobj=new set<String>();
    
    public List<selectOption> getLstdata() 
    {
            List<SelectOption> options = new List<SelectOption>();
          
            Schema.DescribeFieldResult c  = Schema.sObjectType.country__c.fields.city__c.getSObjectField().getDescribe();
                
               for(PicklistEntry e : c.getpicklistvalues())
               {    
                   sobj.add(e.getvalue());
                   options .add(new SelectOption(e.getValue(), e.getLabel()));   
               } 
                                  
            return options;
    }
    public String lst{get;set;}
    public String cname { get; set; }
}
Now i got these fields in VF page.
And i placed a button for submit data into object... 
Assume that, picklist has Hyd,Bang,Chennai.
I used only Hyd to insert the records ....
My requirement is,,
suppose,
if i did not use some values from the picklist to insert the records, i would like to find the un used picklist values in page block below the VF page.
Can u please help me...
Thanks  & Regards: