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
anuj huriaanuj huria 

convert picklist values to textbox in apex page

in my object A there is  a picklist i want to show all the values of picklist in text box in apex page

dont use triggrer

Tavva Sai KrishnaTavva Sai Krishna
Hi anuj,

you can get the picklist values by using the getdescribe() method. here the officelocation__C is custom object which you have to change with the your object name and country__C  is the field in the officelocation__C  object. so change these names as per your metadata in the below code.
string values = '';
   Schema.DescribeFieldResult fieldResult =
   List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
   for( Schema.PicklistEntry f : ple)
      values = values +string.valueof(f.getLabel());
Let me know if you face any issues,

Sai Krishna Tavva.