Submit handler is not called from theme function I am actualy trying to build up a dragable table, but for some reason after implementing the theme_function, my submit handler is not longer getting called.

This is what my Code actualy looks like:

function he_ministerienschalter_theme($existing, $type, $theme, $path) {
  $themes = array(
    'he_ministerienschalter_admin_form' =&gt; array(
      'render element' =&gt; 'element',
    ),
  );
  return $themes;
}


/**
  * Implements the ministerschalter admin form
  */

function he_ministerienschalter_admin_form($form, &amp;$form_state, $form_id, $item) {

  $domainnames = he_ministerienschalter_domainselect();

  $count = 0;
  $form['ressortswitch'] = array(
    '#prefix' =&gt; '&lt;div id="curve-attributes"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
    '#tree' =&gt; TRUE,
    '#theme' =&gt; 'he_ministerienschalter_admin_form',
  );
  foreach ($domainnames as $key =&gt; $domainname) {
      $form['ressortswitch'][$key]['domainID-'.$key] = array(
        '#type' =&gt; 'value',
        '#value' =&gt; $domainname['domain_id'],        
      );
      $form['ressortswitch'][$key]['domainname-'.$key] = array(
        '#type' =&gt; 'item', 
        '#title' =&gt; $domainname['sitename'], 
        '#size' =&gt; 60, 
        '#maxlength' =&gt; 128, 
      );
      $form['ressortswitch'][$key]['domainshort-'.$key] = array(
        '#type' =&gt; 'textfield',
        '#default_value' =&gt; $domainname['sitename'],
      );
      $form['ressortswitch'][$key]['weight-'.$key] = array(
        '#type' =&gt; 'textfield',
        '#default_value' =&gt; !empty($domainname['domain_weight']) ? $domainname['domain_weight'] : '0',
        '#size' =&gt; 3,
        '#attributes' =&gt; array('class' =&gt; array('item-row-weight')),
      );
      $count++;
    }

    $form['ressortswitch']['count'] = array(
      '#type' =&gt; 'hidden',
      '#value' =&gt; $count,
    );
    $form['ressortswitch']['submit'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Save Settings'),
    );

  return $form;
}

/**
  * Theme callback for the he_ministerienschalter_admin_form
  */

function theme_he_ministerienschalter_admin_form($variables) {
  $element = $variables['form'];
  drupal_add_tabledrag('ressortswitch_table', 'order', 'sibling', 'item-row-weight');
  $header = array(
    t('Domainname'),
    t('Domainshort'),
    t('Weight')  
  );

  $element_items = array();

  foreach($element['ressortswitch'] as $id =&gt; $record) {
    if(is_int($id)) {
      $element_items[] = $record;
    }
  }

  $rows = array();
  foreach ($element_items as $id =&gt; $item) {
      $domainNAME[$id] = $item['domainname-'.$id];
      $domainSHORT[$id] = $item['domainshort-'.$id];
      $domainWEIGHT[$id] = $item['weight-'.$id];

    $rows[] = array(
      'data' =&gt; array(
        drupal_render($domainNAME[$id]),
        drupal_render($domainSHORT[$id]),
        drupal_render($domainWEIGHT[$id]),
      ),
      'class' =&gt; array('draggable'),
    );
  }

  $output = theme('table', array(
    'header' =&gt; $header,
    'rows' =&gt; $rows,
    'attributes' =&gt; array('id' =&gt; 'ressortswitch_table'),
  ));

  $output .= drupal_render($element['ressortswitch']['submit']);

  return $output;
}



/**
  * Implements hook_form_submit
  */

function he_ministerienschalter_admin_form_submit($form, &amp;$form_state, $item) {
  db_delete('he_ministerienschalter')
  -&gt;execute();
  $count_domains = $form_state['values']['ressortswitch']['count'];
  $count = 0;
  // dpm($form_state);
  dpm($form_state);
  while($count &lt; $count_domains) {
    db_insert('he_ministerienschalter')
      -&gt;fields(array(
        'domain_id' =&gt; $form_state['values']['ressortswitch'][$count]['domainID-'.$count],
        'domain_short' =&gt; $form_state['values']['ressortswitch'][$count]['domainshort-'.$count],
        'domain_weight' =&gt; $form_state['values']['ressortswitch'][$count]['weight-'.$count]
    ))
    -&gt;execute();
    $count++;
  }
  drupal_set_message('Eingabe gespeichert');
}


Any idea how to solve that?
I Updated my theme function like this and now it works like a charm :-)

$output .= drupal_render($element['form_id']);
$output .= drupal_render($element['form_build_id']);
$output .= drupal_render($element['form_token']);