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
Ahmad HelalAhmad Helal 

Create a VF Page with a list of available Pick-list Values.

I have a custom object with a custom multi-pick-list field and would like create a VF page that displays all the different pick-list value options that users can just use to copy and paste.

Can someone help with the controller and VF page code?

Thanks.
Best Answer chosen by Ahmad Helal
James LoghryJames Loghry
Ahmad,

Using the code that Ankit provided in the link you pasted, you'll use that in  Visualforce controller (or extension).  You'll want to add the picklist values to a List of strings (member variable that is in your controller).

In Visualforce, you'll use the apex:repeat tag to iterate over the list of strings and either use the apex:outputText tag or a merge field {!loopVar} to print the picklist values out.

You stated you wanted to learn more about this, so I would suggest checking out the Visualforce Basics trailhead module here: https://developer.salesforce.com/trailhead/module/visualforce_fundamentals

All Answers

James LoghryJames Loghry
Hi Ahmed,

It sounds like you're looking for someone to write the code for this project. These forums are not meant for that; you'll want to post over on the AppExchange site where you can match up with a developer looking to work on your project. 

https://appexchange.salesforce.com/developers
Ahmad HelalAhmad Helal

I would actually like to learn how to do this. I don't have the resources to just hire a developer for every thing that comes up. If only I had that luxury, my world would be a lot less painful.  I've done some simple apex and VF in the past, but don't develop on a regular basis.This seems pretty straight forward. Maybe someone can help point me in the direction, or another way to accomplish this.

I'm not trying to abuse the forum, but I've seen several cases where people ask a simple question and people will respond back with a full code snippet on how to accomplish it....

I ran across this:

https://developer.salesforce.com/forums/?id=906F00000008zdLIAQ ---- this is the code to get the values; but I want to expand on it and display them on a page so a user can just copy them all at once.

 

William TranWilliam Tran
IF the values are there already, it shouldn't be too bad to to display it. Why you don't post the code you have and describe in more details what you want to do.  Then we can go from there.

Thx
James LoghryJames Loghry
Ahmad,

Using the code that Ankit provided in the link you pasted, you'll use that in  Visualforce controller (or extension).  You'll want to add the picklist values to a List of strings (member variable that is in your controller).

In Visualforce, you'll use the apex:repeat tag to iterate over the list of strings and either use the apex:outputText tag or a merge field {!loopVar} to print the picklist values out.

You stated you wanted to learn more about this, so I would suggest checking out the Visualforce Basics trailhead module here: https://developer.salesforce.com/trailhead/module/visualforce_fundamentals
This was selected as the best answer
Ahmad HelalAhmad Helal
Thanks James --- Exactly what I was looking for. Specfically this part:

In Visualforce, you'll use the apex:repeat tag to iterate over the list of strings and either use the apex:outputText tag or a merge field {!loopVar} to print the picklist values out.

Now that I have a high level understanding; I can research the "nitty gritty" on each step. 

Ya; I've been meaning to do that trail --- I'm at that point now where I need to be more comfortable with basic development. 

Thanks again for your help. =)