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
Madhura BMadhura B 

Radio button in data table select only one



I would like to have radio buttons in each row of a dataTable and the user must be allowed to select only one. That is, the previously selected radio button should be reset when a new radio button on a different row is selected.


Please suggest. 


Also please suggest how to assign value to a variable in the wrapper class from the <input type="radio" >

I tried <apex:param but it did not seem to work 


<input type="radio" name="test" onclick="return confirmSubmit();" value="1">



Madhura BMadhura B

I found a workaround 


function confirmSubmit()
var doSelect = confirm('Are you sure you wish to assign?');
return doSelect;



<apex:dataTable value="{!ContactWrapper}" var="c" >


<apex:inputCheckBox value="{!c.checked}" onclick="return confirmSubmit();" />
<apex:actionFunction name="f1" action="{!methodOne}" rerender="form" >
<apex:param name="conid" value="{!c.ContactId}" id="param1"/>





public void methodOne()
String selcontactid = System.currentPagereference().getParameters().get('conid');

for(wrapper w:ContactWrapper)






public class wrapper
public Contact ContactInfo{get;set;}
public String ContactId{get;set;}
public Boolean checked{get;set;}

public wrapper(Contact c)




This should work but the problem is the last row in the dataTable is getting checked irrespective of which row i select.

Param tag is assigning the last row's id as the value. I can't figure out why...  
Please suggest