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

Replace CheckBox with Radio Button

Hi All,

     I need to use radio button in place of CheckBoxes. But when i try to change the VF tag It is not working.
// The Below code is working fine with no issue //
 <apex:column >
       <apex:inputCheckbox value="{!con.isSelected}" />

///////This is the code which i am using for Radio button. Its showing the radio button but functionality is not working here in case of Radio ////

   <apex:column >                    
       <input type="radio" value= "{!con.isSelected}" />                                     

Kindly help me on this.
Anilkumar KotaAnilkumar Kota

Hi Shephali,

<!-- Page: -->
<apex:page controller="sampleCon">
        <apex:selectRadio value="{!country}">
            <apex:selectOptions value="{!items}"/>
            <apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
     <apex:outputPanel id="out">
          <apex:actionstatus id="status" startText="testing..."> 
             <apex:facet name="stop"> 
                  <p>You have selected:</p> 
                 <apex:outputText value="{!country}"/> 
/*** Controller ***/
public class sampleCon {
    String country = null;
    public PageReference test() {
        return null;
    public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>(); 
        options.add(new SelectOption('US','US')); 
        options.add(new SelectOption('CANADA','Canada')); 
        options.add(new SelectOption('MEXICO','Mexico')); return options; 
    public String getCountry() {
        return country;
    public void setCountry(String country) { = country; }


Hope this will help you..!


   Hi thanks for reply. I have tried such code. The problem it always shows all the Options in one ROW only i need it one option and second in next line and so on...Thats why i tried the HTML tag <Input type= "radio">. But dint get success as it shows the data i wanted but functionality is not achieved.

@AMit Singh... Thanks for reply.. Hope now you understood my actual requirement.
Thiruchuri AdityanThiruchuri Adityan
I think you can use <br/> tag at the selectoptions tag for a line break..
Akshay SoniAkshay Soni
Use layout="pagedirection" attribute in <apex:selectRadio> tag.