title: Create Drupal Form in Table
body: <p>I try to create a table where a row is looking like this:</p>
  
  <pre><code>|Text1|Text2|Button1|
  </code></pre>
  
  <p>As soon as the user clicks on the button I want to exchange the Button1 with tow textFields and another button... so a normal AJAX-request.
  I've tried to implement this, not sure if this is the correct way, let me know if I could to it in a completely other way :S</p>
  
  <p>So what I've already done:
  In my hook_menu i link to a function that returns the data:</p>
  
  <pre><code>return theme ( 'my_theme_function', array (
                      'running' =&gt; true, 
                      'form' =&gt; $database-&gt;getData ()
              ) );
  </code></pre>
  
  <p>What happens in the getData()-Function:
  I create the form using drupal_get_form(..).. returned from the given form is this:</p>
  
  <pre><code>$data = array (
                      'items' =&gt; $finder-&gt;getGamesToPlayForm ( $form_state ), 
                      '#title' =&gt; 'Title'
              );
  </code></pre>
  
  <p>the $finder returns the list of items I want to show in the table. So nothing special.</p>
  
  <p>my_theme_function is set to use a template-file where I would like to show the whole stuff.
  This looks like this:</p>
  
  <pre><code>$header = array (
          'Col1', 
          'Col2', 
          '' 
  );
  
  $rows = array ();
  
  foreach ( element_children ( $formData ['items'] ) as $gameId ) {
      $row = array ();
      $row [] = drupal_render ( $formData ['items'] [$gameId] ['#col1'] );
      $row [] = drupal_render ( $formData ['items'] [$gameId] ['#col2'] );
      $row [] = drupal_render ( $formData ['items'] [$gameId] ['#form'] );
      $rows [] = $row;
  }
  $output = theme ( 'table', array (
          'header' =&gt; $header, 
          'rows' =&gt; $rows 
  ) );
  
  unset($formData['items']);
  
  
  $output .= drupal_render_children ( $formData );
  
  print $output
  </code></pre>
  
  <p>this way, everything is printed correct. But there are no "form"-tags, which stops my form from working..</p>
  
  <p>So, any idea/hint how to solve this kind of problem? Probably I'm on the completely wrong way.. </p>