Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#1 | filefield-duplicate-id-attribute-after-ahah-event-1942306-1.patch | 440 bytes | focal55 |
Comments
Comment #1
focal55 CreditAttribution: focal55 commentedFrom 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.
Comment #2
kscheirerThanks, 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.
Comment #3
quicksketchThanks guys, I've committed #1.