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
OzHarvest Brisbane VolunteerOzHarvest Brisbane Volunteer 

I am new to visualforce pages apex classes. I need the value of a custom picklist field from a contact in a visualforce page. I wish to know the code to get that value. The visualforce page already uses a (non-standard) controller. Thx.

Deepak GerianiDeepak Geriani


I have found a link that might be helpful for you.
This link will help you to understand how to retrieve the data of any picklist value and display it on the Visualforce page and populate it using  <apex:selectList> tags.

If my answer has helped you to resolve your issue please mark this answer as resolved.

OzHarvest Brisbane VolunteerOzHarvest Brisbane Volunteer
Thanks for your quick reply and link Deepak. I have created my apex class ("GetOffice") successfully. Now, In the visualforce page where I need to use the single picklist value, it has this statement at the top:-

<apex:page showHeader="false" id="SiteTemplate" standardStylesheets="false" controller="VolPersonalSiteT" cache="false">

As you can see it already has a controller, so I added mine as an extension:-

<apex:page showHeader="false" id="SiteTemplate" standardStylesheets="false" controller="VolPersonalSiteT" extensions="GetOffice" cache="false">

Now I get the error: Unknown constructor 'GetOffice.GetOffice(VolPersonalSiteT controller)' It seems I have to create a constructor. Unfortunately, after reading 'Using Constructors' in the Apex Developer Guide I am no wiser.
OzHarvest Brisbane VolunteerOzHarvest Brisbane Volunteer
HI! I hope someone can keep helping me with this...