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

visualforce radio button

How to create two radio buttons for one field like:


                                                          for example:  computer:   hardware       software

in above computer fields have to two radio button one for hardware one for software ...





Best Answer chosen by Admin (Salesforce Developers) 

<apex:page controller="sampleCon">
Computers: <apex:selectRadio value="{!country}">
<apex:selectOptions value="{!items}"/>




public class sampleCon {
String country = null;

public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Hardware','Hardware'));
options.add(new SelectOption('SoftWare','SoftWare'));
return options;



public String getCountry() {
return country;

public void setCountry(String country) { = country; }