diff --git a/modules/node.module b/modules/node.module index 3a57c1c873d6a011e51ce3212a765c3e6fb71280..ab6ae83e1920d573a4d997ad0f8722996722b7bb 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1659,12 +1659,15 @@ function node_form_array($node) { return $form; } -function node_form_add_preview($form, $edit) { +function node_form_add_preview($form) { + global $form_values; + $op = isset($_POST['op']) ? $_POST['op'] : ''; if ($op == t('Preview')) { drupal_validate_form($form['form_id']['#value'], $form); if (!form_get_errors()) { - $form['node_preview'] = array('#value' => node_preview((object)$edit), '#weight' => -100); + // We pass the global $form_values here to preserve changes made during form validation + $form['node_preview'] = array('#value' => node_preview((object)$form_values), '#weight' => -100); } } if (variable_get('node_preview', 0) && (form_get_errors() || $op != t('Preview'))) { diff --git a/modules/node/node.module b/modules/node/node.module index 3a57c1c873d6a011e51ce3212a765c3e6fb71280..ab6ae83e1920d573a4d997ad0f8722996722b7bb 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1659,12 +1659,15 @@ function node_form_array($node) { return $form; } -function node_form_add_preview($form, $edit) { +function node_form_add_preview($form) { + global $form_values; + $op = isset($_POST['op']) ? $_POST['op'] : ''; if ($op == t('Preview')) { drupal_validate_form($form['form_id']['#value'], $form); if (!form_get_errors()) { - $form['node_preview'] = array('#value' => node_preview((object)$edit), '#weight' => -100); + // We pass the global $form_values here to preserve changes made during form validation + $form['node_preview'] = array('#value' => node_preview((object)$form_values), '#weight' => -100); } } if (variable_get('node_preview', 0) && (form_get_errors() || $op != t('Preview'))) {