resetting a form

Si Hobbs <[email protected]>
Newsgroups gmane.comp.php.drupal.devel
Message-ID <CAKUW=8zTggEgvCLbpSwf18D4zudjR2qk2A4Fu9HD5oORSieD6w@mail.gmail.com>
Hi

I am doing an ajax callback, and I want to return a fresh version of a
form as content. This is after the form has successfully submitted.

So instead of something like:
  return 'Thanks for your submission';
Which works, I want to do:
  return 'Thanks for your submission' . drupal_render(drupal_get_form('foo'));

However when I get that that form, it is not fresh. The form system
reprocesses the form, re-runs the submit handler, and returns a form
with the $form_state['values'] all populated.

So, I've been trying to work out how to reset the form. For example,
this sort of thing doesn't successfully clear the form:

    cache_clear_all('form_' . $form_state['values']['form_build_id'],
'cache_form');
    cache_clear_all('form_state_' .
$form_state['values']['form_build_id'], 'cache_form');
    drupal_static_reset('drupal_retrieve_form');

Thanks for any tips.

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.