Remove button won't work if element's HTML ID has --# counter

Created on 26 March 2015, over 9 years ago
Updated 17 February 2023, almost 2 years ago

The HTML IDs of a form can change when drupal_html_id() tries to make an ID string unique, appending two hyphens and a number to the ID string (e.g. #original_id--4). This means that if our ajax_command_replace function targets #original_id when it has been updated to, say, #original_id--4, it won't find the element that needs replacing. This happens to me if I use Profile2_panels module to override the default Profile2 Edit path (where the drupal_html_id() function actually runs several times for a normal page render - this could be another issue in itself but is not an exclusive cause of appended numbers).

A similar issue was reported in the Field Collection module ( https://www.drupal.org/node/1675522 β†’ ) upon AJAX and validation. That issue hasn't been finalised yet but tim.plunkett's hack β†’ could be equally applied to this module. Whether a superior solution comes out later is another matter.

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia cmonnow

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024