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
Shephali SwarnkarShephali Swarnkar 

wrapper with radio/option button

This is my VF code displaying the records with checkbox at front. i need to display this list with radio/options so that user can select only option.how to do this??

<apex:pageBlockSection columns="2">
         <apex:pageBlockTable value="{!wrapcontactList}" var="waccl">
            
           <apex:column >
             <apex:facet name="header">
               <apex:inputCheckbox />
             </apex:facet>
            <apex:inputCheckbox value="{!waccl.isSelected}" id="InputId"/>
           </apex:column>
            
            <apex:column value="{!waccl.accn.name}"/>
            <apex:column value="{!waccl.accn.phone}"/>
           
         </apex:pageBlockTable>
Best Answer chosen by Shephali Swarnkar
Vishal_GuptaVishal_Gupta
Hi Shephali,

Please use the below code:
 
              <apex:pageBlockSection>
                   <apex:pageBlockTable value="{!wrapcontactList}" var="waccl">
                        <apex:column >
                              <apex:facet name="header">
                                  Is Selected
                               </apex:facet>
                               <input type="radio" name="accSelected"  id="{!waccl.vAcc.Id}" />
                       </apex:column>
                       <apex:column value="{!waccl.vAcc.name}"/>
                        <apex:column value="{!waccl.vAcc.phone}"/>
                    </apex:pageBlockTable>
              </apex:pageBlockSection>

Please let me know if it will work for you.

Thanks,
Vishal
       

All Answers

Vishal_GuptaVishal_Gupta
Hi Shephali,

Please use the below code:
 
              <apex:pageBlockSection>
                   <apex:pageBlockTable value="{!wrapcontactList}" var="waccl">
                        <apex:column >
                              <apex:facet name="header">
                                  Is Selected
                               </apex:facet>
                               <input type="radio" name="accSelected"  id="{!waccl.vAcc.Id}" />
                       </apex:column>
                       <apex:column value="{!waccl.vAcc.name}"/>
                        <apex:column value="{!waccl.vAcc.phone}"/>
                    </apex:pageBlockTable>
              </apex:pageBlockSection>

Please let me know if it will work for you.

Thanks,
Vishal
       
This was selected as the best answer
Shephali SwarnkarShephali Swarnkar
Thank you Vishal,
               Its working!!