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
sravanisravani 

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.

sravani

Chamil MadusankaChamil Madusanka

Hi,

 

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:selectList>
      <apex:selectOption itemLabel="One" itemValue="One"/>
      <apex:selectOption itemLabel="Two" itemValue="Two"/>
</apex:selectList><p/>

 

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

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_selectList.htm

 

Chamil's Blog

sfdcbynitesfdcbynite

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