Reset node form after AJAX submit I have a node form in a block, that is submitted using AJAX.

I've created my own callback, because I'm adding the created node to the page if the submission was successful.

Now, I want to reset the node form to the default values. Any ideas on how to accomplish that?

Update:
I've managed to replace the form, by looking at the way node_add() works.

$new_node = (object) array(
  'uid' =&gt; $user-&gt;uid,
  'name' =&gt; (isset($user-&gt;name) ? $user-&gt;name : ''),
  'type' =&gt; 'node_type',
  'language' =&gt; LANGUAGE_NONE,
);


And then, I'm replacing the entire form with the return value from drupal_render(drupal_get_form('node_form', $new_node));

The form gets replaced as it should be, apart from some ids being different. However, when I submit the new form, I'll get a javascript alert window, with the entire contents of a new page. I can see from the HTML, that it's the page for the node that has been created. I suppose the AJAX callback gets redirected to the new node, but I don't know why.

Any clues?
Got it!

The main problem was that the new form was loaded from a cached version of the previous submitted form.

This is what I've got in my AJAX callback:

$new_form_state = array();
$new_form_state['build_info']['args'][] = (object) array(
  'uid' =&gt; $user-&gt;uid,
  'name' =&gt; (isset($user-&gt;name) ? $user-&gt;name : ''),
  'type' =&gt; 'node_type',
  'language' =&gt; LANGUAGE_NONE,
);
$new_form_state['no_redirect'] = TRUE;
$new_form_state['input'] = array();
$new_form = drupal_build_form('node_type_node_form', $new_form_state);
$commands[] = ajax_command_replace('#node-type-node-form', drupal_render($new_form));


The $new_form_state['no_redirect'] = TRUE; prevents the redirect, and the empty array in $new_form_state['input'] prevents the form from being loaded from a cached version.

@googletorp, thanks for the help!