On issue edit form 'Preview' and 'View changes' links are not working. Clicking those reloads edit form.

Comments

dww’s picture

Confirmed locally. Only happens on the issue node type, not for example, projects.

I suspected nodechanges was to blame, but I removed that field from the comment bundle and it was still broken.

Don't have time to further investigate now, leaving unassigned.

dww’s picture

Assigned: Unassigned » dww
Status: Active » Fixed

Spent some quality time on the flight back to the US to get to the bottom of this. Basically, I started from scratch with a second issue node type, and kept configuring it more and more like the default project_issue we ship until I found what was breaking preview. Turns out that once you add field_project, preview dies. I then tried to figure out why. To make a long story short, the problem is here:

function project_issue_form_node_form_alter(&$form, &$form_state, $form_id) {
  // We're only interested in issue node forms.                                 
  if (!project_issue_node_is_issue($form['#node']) || empty($form['field_project'])) {
    return;
  }
  $form['#prefix'] = '<div id="project-issue-ajax-form">';
  $form['#suffix'] = '</div>';
  $form['field_project'][LANGUAGE_NONE][0]['target_id']['#ajax'] = array(
    'callback' => 'project_issue_form_change_project',
    'wrapper' => 'project-issue-ajax-form',
  );
  $form['field_project'][LANGUAGE_NONE][0]['target_id']['#element_validate'][] = 'project_issue_field_project_validate';
}

Node previews in D7 are still implemented using $form['#prefix'], so this code is clobbering the preview. I pushed a fix that preserves the existing #prefix (and #suffix, just in case), and now the 'Preview' and 'View changes' buttons are working fine. It even works to change the project once you've previewed and everything still behaves as expected. ;)

http://drupalcode.org/project/project_issue.git/commit/48bbe0d

Now merged into bzr. Should be live on git7 soon.

tvn’s picture

Confirmed, works on git7. Though preview shows huge 'updated this issue' button.

dww’s picture

The huge button is because of #1977594: Issue page: sidebar. I don't think I merged drupalorg into bzr, so the latest update there to configure these might not have happened or something. Anyway, we can clean that up either at #1977594 or #1970046: Properly configure issue fields on rebuild.

Automatically closed -- issue fixed for 2 weeks with no activity.