Im trying to display checkboxes that are multiple selectable. These checkboxes get their value from multi-picklist values from a custom object.
This works and Im able to save the values.
Is there any way to autogenerate checkboxes based on PickList values?
Best Answer
Try
apex:selectCheckboxes
:In your controller have:
And in your Visualforce page:
See the following documentation:
To get a list that contains every picklist value of a field, see here:
Copied from the other post:
Another version but simplifed for a VF controller and a little easier to work with (note the difference in inputs):
If you need to do this often, try making a "Utility" Apex class and add this method as a static method. Write code once and forever.