How to change the check box to radio buttons Yes/No in tableselect form api? How can I add a radio buttons with Yes/No options instead of the checkbox in the tableselect form (api)? 

Here is the code in form.inc on line (3376):

$element[$key] = array(
        '#type' =&gt; 'checkbox',
        '#title' =&gt; $title,
        '#title_display' =&gt; 'invisible',
        '#return_value' =&gt; $key,
        '#default_value' =&gt; isset($value[$key]) ? $key : NULL,
        '#attributes' =&gt; $element['#attributes'],
      );


I changed the code like this:

$element[$key] = array(
        '#type' =&gt; 'radios',
        '#title' =&gt; $title,
        '#title_display' =&gt; 'invisible',
        '#options' =&gt; array(
          '1'   =&gt; t('Yes'),
          '0' =&gt; t('No'),
        ),
        '#return_value' =&gt; $key,
        '#default_value' =&gt; isset($value[$key]) ? $key : NULL,
        '#attributes' =&gt; $element['#attributes'],
      );


When I run it, it shows the form perfectly. But when I click the Submit button it gives me this error:


  "An illegal choice has been detected. Please contact the site administrator." 


Any help?
You need to set '#multiple' =&gt; FALSE on the tableselect where you declare it. This will set the tableselect to use radios rather than checkboxes.