“We want a radio group on a Visualforce page. The values for the radioGroup items on should come from the available picklist items of a custom field and depending upon certain parameters, some of the radio group items should be disabled.” Sounds simple! But this could never be accomplished using standard Visualforce.
Here’s the Apex to create a dynamic radio group:
You can see in the example above how I created an entire form and added other components (i.e. outputLabel) to the page just using Apex. For the sample code, I’m disabling the even numbered items. Here’s what it looks like:
DYNAMIC VISUALFORCE RADIOGROUP