I am working on a custom module with a form. My form uses a cascading drop down where I select a region and then uses ajax to populate another drop down with places from the selected region along with an option to add a new place. When the "add a new place" option is selected it should cause a new textbox to appear in the form. The problem is that after the ajax call returns the filtered places dropdown, the new text box does not appear when I select it from the ajax dropdown results. If I do not use ajax and just return the full unfiltered list, it works fine. For some reason, it is like the ajax call is causing the '#states' information of the add new textbox to be ignored. I am guessing my ajax callback is not returning everything it should but do not know how to fix it.

Here is the code:

<?php
function MY_MODULE_form ($form, &$form_state) {
 
$form['place_type'] = array(
   
'#title' => t('Place type'),
   
'#type' => 'select',
   
'#required' => TRUE,
   
'#options' => array('V' => 'Overseas','D' => 'Domestic'),
  ); 
 
$form['region'] = array(
   
'#title' => t('Select a Region'),
   
'#type' => 'select',
   
'#required' => FALSE,
   
'#options' => array('1'=>'Asia', '2'=>'South America')
   
'#states' => array(
     
'visible' => array(   // action to take.
       
':input[name="place_type"]' => array('value' => 'V'),
      ),
     
'required' => array(   // action to take.
       
':input[name="place_type"]' => array('value' => 'V'),
      ),
    ),
   
'#ajax' => array(
     
'event'=>'change',
     
'callback' =>'places_ajax_dropdown',
     
'wrapper' => 'places-wrapper',
     
'progress' => array(
       
'message' => '',
      ),
    ),
  );
 
$form['place_id'] = array(
   
'#title' => t('Place'),
   
'#type' => 'select',
   
'#required' => FALSE,
   
'#options' => _get_places_by_region($selected_region), //returns a list filtered by region with an option of 'A'=> 'Add New Place' prepended to the results
   
'#prefix' => '<div id="place-wrapper">',
   
'#suffix' => '</div>',
   
'#states' => array(
     
'visible' => array(   // action to take.
       
':input[name="place_type"]' => array('value' => 'V'),
      ),
     
'required' => array(   // action to take.
       
':input[name="place_type"]' => array('value' => 'V'),
      ),
    ),
  );
 
$form['new_place_name'] = array(
   
'#title' => t('Add a new place'),
   
'#type' => 'textfield',
   
'#required' => FALSE,
   
'#size' => 30,
   
'#maxlength' => 150,
   
'#states' => array(
     
'visible' => array(   // action to take.
       
':input[name="place_type"]' => array('value' => 'V'),
       
':input[name="place_id"]' => array('value' => 'A'),
      ),
     
'required' => array(   // action to take.
       
':input[name="place_type"]' => array('value' => 'V'),
       
':input[name="place_id"]' => array('value' => 'A'),
      ),
    ),
  );
  return
$form;
}
function
places_ajax_dropdown($form, $form_state) {
  return
$form['place_id'];
}
?>

Any ideas what I am missing?