+ Start a Discussion

creating picklist field and its values through vf page

hi all,

 i want to create the picklist field and values under particular object using vf page.any one canu please help me and send me the sample code .



thanks in advace.


Chamil MadusankaChamil Madusanka



Are you trying to create pickList values only using VF page? is there any controller help?

What is your field type?

if it is an originally picklist field, you can use inputField in VF page.

if not, you can create values in vf page as follows,


      <apex:selectOption itemLabel="One" itemValue="One"/>
      <apex:selectOption itemLabel="Two" itemValue="Two"/>


If you need to get values from data records, use following approach,




Chamil's Blog


If the field already exists as a picklist on the object then you can use <apex:inputfield> and it will display as a picklist.