The comment.module emits an anhor tag above the comments, so links can be pointed to there, and it is given an id="comment". But since there is a textarea named "comment" in the output of the comment_form() function, and that label tags are connected with ids to form items, another HTML tag gets the id="comment". XHTML does not allow for two elements to have the same ID. The IDs should be unique.

CommentFileSizeAuthor
#6 duplicate_id_comment_reply_form.patch559 byteserikhopp
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Additionaly, the default implementation of comment_form() also emits an "a" tag with id="comment" (even if there are comments above, and there is an "a" tag with id="comment" before them), so if you enable the instant comment form on node pages, you get three HTML tags with id="comment".

Anonymous’s picture

Thanks for heads up.
Easiest thing for me to do personally was just change the ID to a class.
then I can have separate stylings based in .comment anchors or .comment text areas and whatnot.

Gábor Hojtsy’s picture

The comment id is important to get an anchor to link to with comment links, so changing it to a class is not a good option.

TheLibrarian’s picture

I don't seem to have this problem. Maybe your theme is redefining some of the theme_comment hooks?

JonBob’s picture

I can confirm this to be a problem, even with the default themes. The comment reply page has duplicate id="comment" attributes.

erikhopp’s picture

i changed the second id to comment-form as, thats what it is.

the patch does not seem to change the appearance of phptemplate and probably does not change anything else, but you might want to test it first.

one-line patch attached.

erik

Dries’s picture

Committed this patch to HEAD and DRUPAL-4-4. Thanks Erik.

Anonymous’s picture