FAPI text_format field doesn't render In D7 I'm creating a form for a custom module.  I would like one of the form fields to provide a wysiwyg editor (these work and render properly elsewhere around the site).  In my custom form though, the text_format field doesn't render.  If I change the type to 'textarea' it shows up, but as text_format, it's just non-existent in the rendered output.

My code is like this:

function mymodule_menu() {
  $items = array();
  $items['admin/mymodule'] = array(
    'title' =&gt; 'My Module Form',
    'page callback' =&gt; 'mymodule_form',
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
  );
  return $items;
}

function mymodule_form($form_state) {
  $form = array(
    'field1' =&gt; array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; t('Field 1'),
        '$required' =&gt; true,
    ),
    'field2' =&gt; array(
        '#type' =&gt; 'text_format',
        '#title' =&gt; 'Filed 2',
        '#default_value' =&gt; "",
        '#format' =&gt; 'filtered_html',
    ),
  );   
  return $form;
} 


Can anyone spot a problem with this?  What else should I be looking for to understand why the field doesn't render when the type is 'text_format'?
Well I finally figured this one out.  Hopefully this helps someone else out there:

function mymodule_menu() {
  $items = array();
  $items['admin/mymodule'] = array(
    'title' =&gt; 'My Module Form',
    'page callback' =&gt; 'mymodule_callback',
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
  );
  return $items;
}

function mymodule_callback() {
  $form = drupal_get_form('mymodule_form');
  return $form;
}

function mymodule_form($form_state) {
  $form = array(
    'field1' =&gt; array(
      '#type' =&gt; 'textfield',
      '#title' =&gt; t('Field 1'),
      '#required' =&gt; true,
    ),
    'field2' =&gt; array(
      '#type' =&gt; 'text_format',
      '#title' =&gt; 'Filed 2',
      '#default_value' =&gt; "",
      '#format' =&gt; 'filtered_html',
    ),
  );   
  return $form;
} 


For whatever reason, having the menu callback not point directly to the form builder function, but instead at an intermediary function that calls drupal_get_form() caused the text_format type to work properly.