Hi,

Simply reloading the "edit" page for my node causes the "comment settings" radio button to jump around from "disabled" to "read/write", etc.

This often causes comments to be accidentally disabled for nodes where they should be left enabled.

I am seeing this in Firefox. All I have to do is hit the browser's refresh button and the "comment settings" radio button will change values.

-Ryan

Comments

mr.baileys’s picture

Version: 6.7 » 7.x-dev
Component: node system » comment.module
Issue tags: +Usability, +DrupalWTF

Allow me to say WTF to this one... I can reproduce this behavior on D7 (tested it with a book node). Changing component to "comment.module" (since that's where the form part is added, but it might also be a quirk in the form API) and version to 7.x-dev. Also tagged usability because of This often causes comments to be accidentally disabled for nodes where they should be left enabled.

Steps to reproduce: enable comment.module, go to the edit page for an existing node and keep pressing refresh (so far only reported using Firefox though)...

Some observations:
1) bug occurs using Firefox 3.0.6, but does not occur on Chrome 1.0.154.48, IE7 and Opera 9.52 (all on windows)
2) bug only occurs on the node/x/edit page (where the comment section is added via hook_form_alter), not on admin/build/node-type/<type>
3) bug only occurs on a refresh. If you reload the page by pressing enter in the address bar, nothing strange happens
4) inspecting the GET on refresh and the normal get with Firebug show one difference: when refreshing, an extra header is sent with the get request: Cache-control: max-age=0
5) when the bug does happen, it advances one option per request (Disabled > Read Only > Read/Write), and restarts at Disabled on the request after "Read/Write".

The code that adds the form to the node edit page (not sure the bug occurs here though):

/**
 * Implementation of hook_form_alter().
 */
function comment_form_alter(&$form, $form_state, $form_id) {
  if (!empty($form['#node_edit_form'])) {
    $node = $form['#node'];
    $form['comment_settings'] = array(
      '#type' => 'fieldset',
      '#access' => user_access('administer comments'),
      '#title' => t('Comment settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => 30,
    );
    $form['comment_settings']['comment'] = array(
      '#type' => 'radios',
      '#parents' => array('comment_settings'),
      '#default_value' => $node->comment,
      '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')),
    );
  }
}
mr.baileys’s picture

Status: Active » Closed (duplicate)
joshmiller’s picture

Issue tags: -DrupalWTF

Cleaning up DrupalWTF list... Since this is a duplicate, removing tag...