Save node via ajax continuously I'm trying to save a node (with the normal node form) via an ajax callback. The first save works. But after that I want to return the same node form again so that the user can update the values and save the node again. But this second save attempt fails. I always get a message like "this form has already been submitted". Are any solutions for this problem? Or shall I write a custom JS menu hook which saves the node programmatically?

Here are the relevant parts of my module

function MYMODULE_form_finding_node_form_alter (&amp;$form, &amp;$form_state){
  $form['#prefix'] = '&lt;div id="wrapper"&gt;';
  $form['#suffix'] = '&lt;/div&gt;';
  $form['actions']['submit']['#ajax'] = array(
    'callback' =&gt; 'MYMODULE_finding_node_form_submit_ajax',
    'wrapper' =&gt; 'finding-form-wrapper'
  );
}


function MYMODULE_finding_node_form_submit_ajax($form, &amp;$form_state){
  $form_id = '#' . str_replace('_','-',$form['#form_id']);
  $commands = array();
  $commands[] = ajax_command_remove('.l-messages');
  if(form_get_errors()){
    $commands[] = ajax_command_replace($form_id, '&lt;div id="finding-form-wrapper"&gt;&lt;/div&gt;');
    $commands[] = ajax_command_replace('#finding-form-wrapper', drupal_render($form));
  }
  else{
    $node = $form_state['node'];
    $form_state = array();
    $form_state['rebuild'] = TRUE;
    $form_state['build_info']['args'] = array($node);
    $form = drupal_build_form('finding_node_form', $form_state);
    $form['#id'] = str_replace("_", "-", $form_id);

    $commands[] = ajax_command_replace($form['#id'], drupal_render($form));
  }
  $commands[] = ajax_command_prepend('.page', '&lt;section class="l-messages row"&gt;&lt;div class="columns"&gt;' . theme('status_messages') . '&lt;/div&gt;&lt;/section&gt;');
  return array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);
}
So I managed to figure it out myself. It just seems that you need to build up the whole new form state manually and then rebuild the form with that state again. Here's my modified code for the ajax submit handler. But if anyone still has a better solution please post your answer here.

function MYMODULE_finding_node_form_submit_ajax($form, &amp;$form_state){
  $commands = array();
  $commands[] = ajax_command_remove('.l-messages');
  if(form_get_errors()){
    $commands[] = ajax_command_replace(NULL, drupal_render($form));
  }
  else{
    $node = $form_state['node'];
    $new_form_state = array();
    $new_form_state['build_info']['args'][] = $node;
    $new_form_state['no_redirect'] = TRUE;
    $new_form_state['input'] = array();
    $new_form_state['values'] = array();
    $new_form_state['method'] = $form_state['method'];
    $new_form = drupal_rebuild_form('finding_node_form', $new_form_state);

    $commands[] = ajax_command_replace(NULL, drupal_render($new_form));
  }
  $commands[] = ajax_command_prepend('.page', '&lt;section class="l-messages row"&gt;&lt;div class="columns"&gt;' . theme('status_messages') . '&lt;/div&gt;&lt;/section&gt;');

  return array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);
}