In HTML, ids must be unique.

Because field groups have / can have id attributes, in the case a field group is outputted multiple times in a single HTML page, the resulting HTML is invalid.

Unfortunately fixing this would break existing CSS selectors used by sites / themes, so maybe this one should be fixed in 2.x?

CommentFileSizeAuthor
#1 div_duplicate_ids.patch831 bytesrreiss
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rreiss’s picture

Status: Active » Needs review
FileSize
831 bytes

I've created a patch to solve this issue using drupal_html_id .
Please review.

Pere Orga’s picture

Just checked and the issue cannot be reproduced anymore on dev. Is this a duplicate?

rreiss’s picture

Title: Do not use HTML id attribute on fieldgroups » Duplicate HTML id attribute on fieldgroups
Component: Miscellaneous » Code

You're right - the validation errors are gone when using the dev version.
The "fix" on the dev version was to completely remove the field group's id attribute, I don't think this is the right decision.
What about upgrading from V1.3 to a newer version? CSS styles may be broken for those who used the IDs.
The Drupal way is to use drupal_html_id to prevent those issues.

BTW - The patch from my first comment is for 7.x-1.3 .

Pere Orga’s picture

Note that your patch would break existing CSS selectors too

rreiss’s picture

Mine will only break on the case when someone used the ID selector to style multiple field group with the same ID, instead of using the class attribute.
In my opinion, if someone doesn't follow HTML and CSS standards it's his/her fault.

nils.destoop’s picture

Status: Needs review » Closed (duplicate)

This is indeed a duplicate of #2037731.
Gonna release a new version today. The fix will then be also available in a stable release.

Status: Closed (duplicate) » Needs work

The last submitted patch, 1: div_duplicate_ids.patch, failed testing.

nils.destoop’s picture

Status: Needs work » Closed (fixed)