Dynamic configuration form i need to do a configuration file wich allow an admin to select a lot of terms from a vocabulary. Then i want to make a form with 2 select field : Vocabulary and Terms. So, i can select the vocabulary i want and a lot of terms of a vocabulary but i don't know to show all terms of the selected vocabulary.

My code :

/*
 * ==================================
 * CONFIGURATION MODULE
 * ==================================
 */
function food_truck_form_admin() {
  $form = array();
  $form['vocabulary'] = array(
      '#title' =&gt; 'Vocabulary',
      '#type' =&gt; 'select',
      '#options' =&gt; food_truck_form_vocabularies()
  );
  $form['terms'] = array(
      '#title' =&gt; 'Terms',
      '#type' =&gt; 'select',
      '#multiple' =&gt; TRUE,
      '#options' =&gt; food_truck_form_terms('marqueurs')
  );

  return system_settings_form($form);
}

/**
 * Implementation of hook_menu()
 */
function food_truck_form_menu() {
  $items = array();
  $items['admin/settings/food_truck_form'] = array(
      'title' =&gt; 'Food-Truck Configuration',
      'description' =&gt; 'Global configurations',
      'page callback' =&gt; 'drupal_get_form',
      'page arguments' =&gt; array(
          'food_truck_form_admin'
      ),
      'access arguments' =&gt; array(
          'administer food_truck_form settings'
      ),
      'type' =&gt; MENU_NORMAL_ITEM
  );

  return $items;
}

/*
 * ==================================
 * OTHER FUNCTIONS
 * ==================================
 */

/*
 * Return a term list of a vocabulary by it's machine name or null
 */
function food_truck_form_terms($machine_name) {
  if (! empty($machine_name)) {
    $vid = taxonomy_vocabulary_machine_name_load($machine_name)-&gt;vid;
    $terms = taxonomy_get_tree($vid);
    foreach ($terms as $data) {
      $output[$data-&gt;tid] = $data-&gt;name;
    }
    return $output;
  }
  return NULL;
}
/*
 * Retur a vocabulary list or null
 */
function food_truck_form_vocabularies() {
  $vocabulary = taxonomy_get_vocabularies();
  if (count((array) $vocabulary) != 0) {
    foreach ($vocabulary as $data) {
      $output[$data-&gt;vid] = $data-&gt;name;
    }
    return $output;
  }

  return NULL;
}
Thanks, i've did this and this work perfectly :

/*
 * ==================================
 * CONFIGURATION MODULE
 * ==================================
 */
/**
 * Implementation of hook_admin()
 */
function food_truck_form_admin() {
  $form = array();
  $form['vocabulary'] = array(
      '#title' =&gt; 'Vocabulaires',
      '#type' =&gt; 'select',
      '#options' =&gt; food_truck_form_vocabularies(),
      '#ajax' =&gt; array(
          'callback' =&gt; 'terms_callback',
          'wrapper' =&gt; 'terms-wrapper',
          'event' =&gt; 'change'
      )
  );
  $form['terms'] = array(
      '#title' =&gt; 'Types de marqueurs',
      '#type' =&gt; 'select',
      '#prefix' =&gt; '&lt;div id="terms-wrapper"&gt;',
      '#suffix' =&gt; '&lt;/div&gt;',
      '#multiple' =&gt; TRUE,
      '#options' =&gt; food_truck_form_terms('marqueurs')
  );
  return system_settings_form($form);
}

/**
 * Implementation of hook_menu()
 */
function food_truck_form_menu() {
  $items = array();
  $items['admin/settings/food_truck_form'] = array(
      'title' =&gt; 'Food-Truck Configuration',
      'description' =&gt; 'Global configurations',
      'page callback' =&gt; 'drupal_get_form',
      'page arguments' =&gt; array(
          'food_truck_form_admin'
      ),
      'access arguments' =&gt; array(
          'administer food_truck_form settings'
      ),
      'type' =&gt; MENU_NORMAL_ITEM
  );

  return $items;
}

/**
 * CALLBACKS
 */
function terms_callback($form, &amp;$form_state) {
  $machine_name = $form['vocabulary']['#options'][$form_state['values']['vocabulary']];
  $form['terms']['#options'] = food_truck_form_terms($machine_name);
  return $form['terms'];
}
/*
 * ==================================
 * OTHER FUNCTIONS
 * ==================================
 */

/*
 * Return a term list of a vocabulary by it's machine name or null
 */
function food_truck_form_terms($machine_name) {
  if (! empty($machine_name)) {
    $vid = taxonomy_vocabulary_machine_name_load($machine_name)-&gt;vid;
    $terms = taxonomy_get_tffree($vid);
    foreach ($terms as $data) {
      $output[$data-&gt;tid] = $data-&gt;name;
    }
    return $output;
  }
  return NULL;
}
/*
 * Retur a vocabulary list or null
 */
function food_truck_form_vocabularies() {
  $vocabulary = taxonomy_get_vocabularies();
  if (count((array) $vocabulary) != 0) {
    foreach ($vocabulary as $data) {
      $output[$data-&gt;vid] = $data-&gt;machine_name;
    }
    return $output;
  }

  return NULL;
}