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
maheshkovvadamaheshkovvada 

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) 
kiranmutturukiranmutturu

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

</apex:form>

</apex:page>

 

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;
}

 

class

public String getCountry() {
return country;
}

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


}