I'm having some difficulty rendering a checkbox in a table and need a little assistance.
I've place the following code before I start building my table:
$form['myCheckBox] = array(
'#type' => 'checkbox',
'#title' => (''),
'#tree' => TRUE
);
I'm building my rows array and headers array to theme a table. I'm then trying to place a checkbox in the table using form_render.
$rows[] = array('data' => form_render($form['myCheckBox']), 'style' => 'text-align:right !important;padding:0 4px;');
$headers[] = array('data' => t('Dummy Column), 'style' => 'width:166px;padding:0 4px;');
then I theme the table:
output .= theme('table', $headers, $rows);
?
<strong>I've also added a submit button:</strong>
<?php
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save Changes'),
);
And I then call drupal_get_form and return my output:
$output .= drupal_get_form('dummyName_form', $form);
return $output;
My checkbox renders in the correct position in the table; however, after clicking submit and printing the $form_values I'm not able to determine if they have been set or not. They always stay in the zero (0) state.
Drupal gives me this error: