Setting a header for checkmark in tableselect I am interesting in adding text next to the checkmark in the table #header.



As you can see from the photo there isn't any text there.

My code for the table:

$header = array(
    'campground' =&gt; t('Campground'),
    'name' =&gt; t('Name'),
    'phone' =&gt; t('Phone Number'),
    'message' =&gt; t('Message'),
  );

$form['table'] = array(
    '#type' =&gt; 'tableselect',
    '#header' =&gt; $header,
    '#options' =&gt; $options,
    '#default_value' =&gt; $values,
    '#empty' =&gt; t('No campground to claim'),
  );


Is it possible to add a title next to the checkmark?
I ended up needing to keep the label actually in the correct column, and so went a different route.  I have jQuery available to me as well.

I added an #after_build to my form that would insert some JavaScript:

$form['#after_build'][] = 'mymodule_config_form_after_build';


Then in that function, added:

function mymodule_config_form_after_build($form, &amp;$form_state) {
$data = &lt;&lt;&lt; EOT
  jQuery(document).ready(function(){
        var liveTable = jQuery("#edit-variables table").filter(function() {return !(jQuery(this).css('visibility') == 'hidden' || jQuery(this).css('display') == 'none');}); // Get the right table
        var cb = jQuery("th.select-all input[type='checkbox']", liveTable); // get the right checkbox
        if (cb.length == 1) { // attempt at being smart
            var th = jQuery("th.select-all", liveTable); // Need the table head next
            th.css('width', '15%'); // I found the auto width logic was messing up the table, so I put in this hack to cover my label width
            cb.attr('name', 'form-select-all');
            cb.attr('id', 'form-select-all');
            var label = jQuery("&lt;label for='form-select-all' style='padding: 0px;'&gt;Active Replacement?&lt;/label&gt;");
            cb.before(label).detach().prependTo(label); // put the label in and move the checkbox before it

        }
    });

EOT;
drupal_add_js($data, 'inline');
return $form;


The first jQuery filtering is needed because Drupal seems to add a hidden table to help facilitate header handling (???).  I was coming up with too many tables and check boxes.