Form theming with templates Please could someone explain why the following doesn't work?

This is in the form build:

$form['#theme'] = 'some_form';


Here's the hook_theme function:

function MYMODULE_theme($existing, $type, $theme, $path) {
    return array(
      'some_form' =&gt; array(
        'template' =&gt; 'some-form',
        'variables' =&gt; array('form' =&gt; NULL),
      ),
    );
}


The template (some-form.tpl.php):

&lt;div id="some-form"&gt;
&lt;?php print render($form); ?&gt;
&lt;/div&gt;


You can see the wrapper markup from the template file but the form is not being output.
Since you're attaching the #theme to an element, you need to user render element in your theme declaration in place of variables:

function MYMODULE_theme($existing, $type, $theme, $path) {
  return array(
    'some_form' =&gt; array(
      'template' =&gt; 'some-form',
      'render element' =&gt; 'form'
    ),
  );
}


After you clear the caches your template should start being used for that form. 

See hook_theme() for more information.

Just another thought, if your template file is as trivial as just wrapping the form in a tag you can use the #prefix and #suffix properties on the $form object instead of using a theme at all:

$form['#prefix'] = '&lt;div id="some-form"&gt;';
$form['#suffix'] = '&lt;/div&gt;';