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
Padmanabhan KamuniPadmanabhan Kamuni 

Need to select one checkbox at a time??

public class Task0 {   
    public List<wrapGroup> acc{get;set;}
    public List<Group__c> abc{get;set;}
    public List<Group__c> abc1{get;set;}
    public string Recid{get;set;}
    
    public Task0(){    
        {
            acc=new List<wrapGroup>();
            abc1 = new List<Group__c>();
              List<Group__c> gcc=[SELECT name,id,Course_Name__c,Degree__c,Mobile__c FROM Group__c];
              For(Group__c g : gcc  ){
              acc.add(new wrapGroup(g));
              }
          }
          system.debug(acc);
  }   
    public pageReference del(){
      // abc=new List<Group__c>();
         for(wrapGroup a : acc){
        if(a.checkbox1 == true){            
           abc1.add(a.gname);           
           //string recid = ApexPages.CurrentPage().getParameters().get('a.id');            
            //string recid;
            system.debug(' abc1'+abc1);
            //abc=[select id FROM Group__c WHERE id= :Recid];
            //system.debug('List'+abc);                      
            }
        }
          delete abc1;          
        return null;
    }   
    public class wrapGroup{
        public Group__c gname{get;set;}
            public boolean checkbox1{get;set;}       
    public wrapGroup(Group__c g){
        gname=g;
        checkbox1=false;
    }     
    }
 }


 
<apex:page controller="Task0" >
    <apex:form >
       <script>
         function enableDisable(cb)
    {
      $("input:checkbox[id*=looped]").removeAttr('checked');
      $(cb).attr('checked', 'checked');
    }
		</script>
        <apex:pageBlock >
            <!--<apex:commandButton value="Delete" action="{!Del}" />-->
            <apex:pageBlockTable value="{!acc}" var="a" >
                <apex:column value="{!a.gname.name}"/>
                <apex:column value="{!a.gname.Mobile__c}"/>
                <apex:column value="{!a.gname.Course_Name__c}"/>
               <!-- <apex:column >
                    <apex:outputField value="{!a.gname.Id}">
                <apex:param value="{!a.gname.id}" assignTo="{!Recid}" />  
                    </apex:outputField>
                </apex:column>-->
                <apex:column title="Select to Delete" >
                   
                 <apex:inputCheckbox id="looped" value="{!a.checkbox1}" onclick="enableDisable(this)" />                   
                        
                </apex:column>
               
            </apex:pageBlockTable>
         </apex:pageBlock>
     </apex:form>   
</apex:page>

 
Best Answer chosen by Padmanabhan Kamuni
Aslam ChaudharyAslam Chaudhary
Please verify you have included JQuery refrences.

All Answers

Padmanabhan KamuniPadmanabhan Kamuni
Kindly help me.. Any Developers out there to solve.
Aslam ChaudharyAslam Chaudhary
Please verify you have included JQuery refrences.
This was selected as the best answer
Padmanabhan KamuniPadmanabhan Kamuni
Yeah, I have used the JQuery which I found online & seems to be correct. Can we do this without JQuery with some modification in code?
kindly let me know. 

Awaiting for your response.
Thanks in advance