title: How to rebuild a form in Drupal 7
body: <p>I am trying to rebuild a form in Drupal 7. I know its 'form_build_id' (e.g. form-_eNZLqaZWy7-6kYuGma5Cxg1Gru7Tmr9W2tsofSJxSg)</p>
  
  <p>I defined this hook_menu and menu callback function:</p>
  
  <pre><code>/**
   * Implements hook_menu().
   */
  function set_menu_menu() {
    $items['admin/structure/set_menu/rebuild/%'] = array(
      'title' =&gt; 'Rebuilt',
      'page callback' =&gt; 'set_menu_ajax_rebuild',
      'page arguments' =&gt; array(4),
      'access callback' =&gt; TRUE,
    );
    return $items;
  }
  
  function set_menu_ajax_rebuild($form_build_id) {
  $form_state = form_state_defaults();
  $form = form_get_cache($form_build_id, $form_state);
  
  $form_state['no_redirect'] = TRUE;
  
  // @see drupal_rebuild_form()
  
  $form_state['set_menu']['count']++;
  $form_state['rebuild'] = TRUE;
  
  drupal_process_form($form['#form_id'], $form, $form_state);
  
  }
  </code></pre>
  
  <p>I would like to rebuild a form by hitting url like this 
  <a href="http://www.example.com/admin/structure/set_menu/rebuild/form-mQVd8FeimUAba8xuro38Q2_4phHZ6gupegEuY_ddKLs" rel="nofollow">http://www.example.com/admin/structure/set_menu/rebuild/form-mQVd8FeimUAba8xuro38Q2_4phHZ6gupegEuY_ddKLs</a> - this url displays no error but it does not rebuild my form.</p>
  
  <p>The code never rebuilds any form. How can I rebuild a form?</p>
  
  <p>Thank you, Martin.</p>