Commit a45b6488 authored by Dries's avatar Dries
Browse files

- Patch #643656 by sun: comment 'Save' button disappears on form validation error.

parent a6f79394
...@@ -1944,14 +1944,12 @@ function comment_form($form, &$form_state, $comment) { ...@@ -1944,14 +1944,12 @@ function comment_form($form, &$form_state, $comment) {
$form['node_type'] = array('#type' => 'value', '#value' => 'comment_node_' . $node->type); $form['node_type'] = array('#type' => 'value', '#value' => 'comment_node_' . $node->type);
// Only show the save button if comment previews are optional or if we are // Only show the save button if comment previews are optional or if we are
// already previewing the submission. However, if there are form errors, // already previewing the submission.
// we hide the save button no matter what, so that optional form elements
// (e.g., captchas) can be updated.
$form['actions'] = array('#type' => 'actions'); $form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array( $form['actions']['submit'] = array(
'#type' => 'submit', '#type' => 'submit',
'#value' => t('Save'), '#value' => t('Save'),
'#access' => ($comment->cid && user_access('administer comments')) || variable_get('comment_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || (!form_get_errors() && isset($form_state['comment_preview'])), '#access' => ($comment->cid && user_access('administer comments')) || variable_get('comment_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || isset($form_state['comment_preview']),
'#weight' => 19, '#weight' => 19,
); );
$form['actions']['preview'] = array( $form['actions']['preview'] = array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment