Unable to set default value for checkbox form element inside tableselect I've created a custom table using a tableselect element, and within each row, I have a checkbox form element that should populate the checkbox from a checkbox field in the node. I've tried every possible format of #default_value (setting it to 1, array(1), etc), to no avail. Since in HTML it's the checked attribute that causes a checkbox to show as checked, I came up with this option:

  foreach($translations as $locale =&gt; $locale_data) {
    // Get data for other fields...

    // Get data for Staging Only checkbox
    $staging_only = isset($entity-&gt;field_pub_staging_only[$locale]) ? (int)$entity-&gt;field_pub_staging_only[$locale][0]['value'] : 0;

    $row = array(
     'language_locale' =&gt; $locale_link,
     'status' =&gt; $status,
     'stage_url' =&gt; $stage_url,
     'start_date' =&gt; array(
       'data'=&gt; array(
         '#type'=&gt;'textfield',
         '#value'=&gt; $new_start_date,
         '#title' =&gt; 'Start Date',
         '#title_display'=&gt;'invisible',
         '#name'=&gt; 'start_date[' . $locale . ']',
         '#id'=&gt;  'start-date[' . $locale . ']',
         '#attributes' =&gt; array('class' =&gt; array('datepicker')),
         '#size' =&gt; 10,
         '#maxlength' =&gt; 10
       ),
     ),
     'end_date' =&gt; array(
       'data'=&gt; array(
         '#type'=&gt;'textfield',
         '#value'=&gt; $new_end_date,
         '#title' =&gt; 'End Date',
         '#title_display'=&gt;'invisible',
         '#name'=&gt; 'end_date[' . $locale . ']',
         '#id'=&gt; 'end-date[' . $locale . ']',
         '#attributes' =&gt; array('class' =&gt; array('datepicker')),
         '#size' =&gt; 10,
         '#maxlength' =&gt; 10
       ),
     ),
      'staging_only' =&gt; array(
        'data'=&gt; array(
          '#type'=&gt;'checkbox',
          '#title' =&gt; 'Staging Only',
          '#title_display'=&gt;'invisible',
          '#name'=&gt; 'staging_only[' . $locale . ']',
          '#id'=&gt; 'staging_only[' . $locale . ']',
          '#default_value' =&gt; $staging_only
        ),
      ),
      'display_title' =&gt; $title
    );

    if ($staging_only) {
      $row['staging_only']['data']['#attributes'] = array('checked' =&gt; array('checked'));
    }

    $options[$locale] = $row;
  }

  $header = array(
    'language_locale' =&gt; t('Language Locale'),
    'status' =&gt; t('Status'),
    'stage_url' =&gt; t('Stage URL'),
    'start_date' =&gt; t('Start Date'),
    'end_date' =&gt; t('End Date'),
    'staging_only' =&gt; t('Staging Only'),
    'display_title' =&gt; t('Display Title')
  );

  $form['table'] = array(
    '#type' =&gt; 'tableselect',
    '#header' =&gt; $header,
    '#options' =&gt; $options,
    '#empty' =&gt; t('No content available.'),
    '#attributes' =&gt; array('id' =&gt; array('locale-table')),
  );

...

  $form['submit'] = array(
    '#type'=&gt;'submit',
    '#value' =&gt; 'Submit',
  );

  return $form;
}


where I'm basically manually added the checked attribute to the element when it's checked. It works, but it seems sort of hackish, since it's not using what would normally be used to set a form element value with Form API. Is there a better way to do this with the usual Form API settings?

CLARIFICATION It appears that my question wasn't clear, based on the answers I've received so far. The issue is not whether the tableselect row checkbox is checked by default; the issue is attempting to mark as checked the staging_only checkbox, which is a separate from api element within the tableselect row.
I remember struggling with this for a moment ! The documentation is not so explicit.. 

The tableselect element takes a #default_value array as a multiple select element would do, that is at the same level as the #options array, and with each selected option key being mapped to a truthy value, usually integer 1. 

In the foreach, you would do something like this : 

if ($staging_only) {
  // $row['staging_only']['data']['#attributes'] = array('checked' =&gt; array('checked'));
  $selection[$locale] = 1;
}


And then :

$form['table'] = array(
  '#type' =&gt; 'tableselect',
  '#header' =&gt; $header,
  '#options' =&gt; $options,
  '#default_value' =&gt; $selection,
  '#empty' =&gt; t('No content available.'),
  '#attributes' =&gt; array('id' =&gt; array('locale-table'))
);


Non present options in the selection array default to false so you can ignore unchecked values.