Using the default theme (blue marine) and enabling every possible block ;-) i provoked the following error. It seems that the form id used for the login block and the search block are identical, causing this error at w3c.orgs validation service:

This page is not Valid XHTML 1.0 Strict!

Below are the results of checking this document for XML well-formedness and validity.
Error Line 60 column 46: ID "edit-form_id" already defined.

...pe="hidden" name="edit[form_id]" id="edit-form_id" value="user_login_block"

An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).


Info Line 26 column 46: ID "edit-form_id" first defined here.

input type="hidden" name="edit[form_id]" id="edit-form_id" value="search_box" />

CommentFileSizeAuthor
#6 no_id_for_hidden_elements.patch616 byteschx

Comments

morbus iff’s picture

Assigned: Unassigned » morbus iff
Status: Active » Closed (won't fix)

I think I'm gonna set this as wontfix, though it's certainly open for interpretation.

* Enabling the search.module adds a search form to the header of the bluemarine template.
* Enabling the search block adds the same search form to the sidebar.

They're the exact same form, in every possible way (save for their visual appearance, which is of little consequence in comparison to their action or their markup, which is what w3 checks for, of course). I'd say, honestly, that both approaches are right: yes, there's a duplicate ID because you've enabled a duplicate form on the site.

Pick only one ;)

morbus iff’s picture

Status: Closed (won't fix) » Active

I'm an idiot. While it does hold true about the two search blocks, he was talking about user_login. Reexamining.

morbus iff’s picture

Assigned: morbus iff » Unassigned
netbjarne’s picture

Hey - I'm, glad that I wasn't supposed to choose either to have a login block OR a search block on my site - but not both ;-)

Nice work folks, this is going to be a great release :-D

Thox’s picture

This applies to all pages with more than one form, since all forms have a form_id element.

chx’s picture

Component: base system » forms system
Assigned: Unassigned » chx
Status: Active » Reviewed & tested by the community
StatusFileSize
new616 bytes

Solution is brutal but effective: I deleted id from hidden elements.

morbus iff’s picture

I agree with this approach.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)
freebt’s picture

Version: » x.y.z

When search block is enabled,cannot pass html validation(http://validator.w3.org).

Page DOCTYPE setting:

freebt’s picture

Status: Closed (fixed) » Active

When search block is enabled,cannot pass html validation(http://validator.w3.org).

Page DOCTYPE setting:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
archetwist’s picture

Pages don't pass validation because some IDs are declared more than once. Example error message:

Error Line 286 column 286: ID "edit-form_id" already defined.
...input type="hidden" name="edit[form_id]" id="edit-form_id" value="user_login_

And this is because of this code (form.inc, line 972):

function theme_hidden($element) {
  return '<input type="hidden" name="'. $element['#name'] . '" <strong>id="'. $element['#id'] . '"</strong> value="'. check_plain($element['#value']) ."\" " . drupal_attributes($element['#attributes']) ." />\n";
}

The id="'. $element['#id'] . '" part has been added in the latest RC.

grohk’s picture

Status: Active » Closed (duplicate)

Bug has been re-introduced by patch #60017

A new issue and patch have been created. Marking as a duplicate of http://drupal.org/node/62366

archetwist’s picture

Version: x.y.z » 4.7.0-beta1
Status: Closed (duplicate) » Closed (fixed)