Scenario: Editing a node with a CCK imagefield element. Image has been previously added to the node. While editing the node, the user clicks the remove button to remove the uploaded image. An AHAH event occurs and refreshes the CCK imagefield element.

Problem: If you inspect the DOM after removing the image, the replaced portion duplicates the "wrapper" element which cause two divs with the same ID attribute.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

focal55’s picture

From my experience in working with AHAH for drupal 6 it's common to unset the #prefix and #suffix attributes of the form element you are refreshing. This seems to be missing from Filefield's implementation, specifically in the filefield_js() function. I have added it in this patch.

kscheirer’s picture

Status: Active » Reviewed & tested by the community

Thanks, this patch fixed the problem for me! I was trying to theme these elements, and duplicate ID's make that hard, as well as not being valid HTML markup.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks guys, I've committed #1.

Status: Fixed » Closed (fixed)

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