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
atallatall 

I'm able to select all the radio buttons in a VF Page

Hi I've created 3 Radio Buttons using Visual Force in Developer Edition, but the problem is I'm able to select all the 3 radio buttons at a time whereas my requirement is that I've to select only one and must be able to deselect the other 2 radio buttons Please help me in this regard and let me know if you have any questions.
asish1989asish1989

Hi atal

  Radiobuttom means you can select one at a time.No multiselection is possible in radiobuttom.If you are able to select multiple at a time then please share your code...

 Here I have posted a code please refer this.In my code I have designed radio buttom for MALE and FEMALE.....

   <apex:page controller = "mycontroller">

  .........................................................................

...........................................................................

   <apex:outputLabel value="Gender" for="gender">
        <apex:selectRadio value="{!gender}">
        <apex:selectOptions value="{!options}" id="gender"/>
        </apex:selectRadio>
        </apex:outputLabel>

  </apex:page>

 

NOw my controller is.....

  public class mycontroller {

   public List<SelectOption> options {get;set;}

  

public  mycontroller() {

    options = new List<SelectOption>();
     options.add(new SelectOption('Male','Male'));
     options.add(new SelectOption('Female','Female'));

}

}

Try this...

please let me know If there is any problem....otherwise please mark it solved for future reference...

 

 

Thanks

asish

 

Ulas KutukUlas Kutuk

asish is right you can not select more than one at a time using radio button... You probably used select check box...