diff --git a/autosave.module b/autosave.module index 65411b2..03be427 100644 --- a/autosave.module +++ b/autosave.module @@ -183,6 +183,11 @@ function autosave_form_alter(&$form, &$form_state, $form_id) { if (($autosave_node_form || in_array($form_id, $form_ids))) { // Remove the autosaved form when submitting it. array_unshift($form['#submit'], 'autosave_remove_autosaved_form_submit'); + + // Autosaved forms need to be cached so that $form_state can be retrieved + // with ajax_get_form() during save. + $form_state['cache'] = TRUE; + if (empty($_POST['autosave_form_path'])) { $request_path = request_path(); // We store the drupal system paths, not the aliases. @@ -282,14 +287,6 @@ function autosave_restore($form_id, $timestamp) { if ($record) { $form_state = unserialize($record->serialized); - // We need to extract and reuse any additional page arguments that the - // original form may have. That's especially true for, say, a node form, - // which needs the node object passed in as well. - $menu_item = autosave_menu_get_item($record->path); - if ($menu_item['include_file']) { - require_once DRUPAL_ROOT . '/' . $menu_item['include_file']; - $form_state['build_info']['files'][] = $menu_item['include_file']; - } // Disable the "this form has already been submitted" nonsense by making // Drupal think the form is being rebuilt as part of a multi-step form.