I'm trying to display Picklist field as Radio buttons on Visualforce page. On selection of any radio button, how to make other buttons disabled?
For instance there is a field by named "Lead Source" on Contact Object with LOVs as Web, Phone Inquiry, Partner Referral, Purchased List, Other.
Once the user selects "Web", rest of the radio buttons has to be disabled.
Page:
<apex:page standardController="Contact" extensions="DisableRadioButton">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection>
<apex:selectRadio value="{!Contact.LeadSource}">
<apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectRadio>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
Controller:
public class DisableRadioButton{
public DisableRadioButton(ApexPages.StandardController controller) {
}
public List<SelectOption> getTypes(){
Schema.sObjectType sobject_type = contact.getSObjectType();
Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
List<Schema.PicklistEntry> pick_list_values = field_map.get('LeadSource').getDescribe().getPickListValues();
List<selectOption> options = new List<selectOption>();
for (Schema.PicklistEntry a : pick_list_values) {
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}
}
I have referred few solutions by using actionsupport and jQuery, but in all those there were two different fields, based on selection of one field the other field can be disabled. In my case Lead Source is one field and LOVs are radio buttons.
Any approach that can anyone suggest?
<apex:selectRadio
for community users.