XHTML validation of contact-form, double id's changed

ntiostle - February 26, 2007 - 18:33
Project:Drupal
Version:6.x-dev
Component:contact.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:patch (code needs work)
Description

The validation of a drupal 5.1 site-wide contact-page looks like that:

Below are the results of checking this document for XML well-formedness and validity.

   1. Error Line 85 column 52: ID "edit-name" already defined.

      ...ext" maxlength="255" name="name" id="edit-name"  size="60" value="" class="fo

      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).

      ✉
   2. Info Line 64 column 51: ID "edit-name" first defined here.

      ...text" maxlength="60" name="name" id="edit-name"  size="15" value="" class="fo

   3. Error Line 103 column 35: ID "edit-submit" already defined.

      <input type="submit" name="op" id="edit-submit" value="E-Mail senden"  class="fo

      ✉
   4. Info Line 38 column 35: ID "edit-submit" first defined here.

      <input type="submit" name="op" id="edit-submit" value="Suchen"  class="form-subm

The patch should fix that.

AttachmentSize
contact.module_32.patch727 bytes

#1

spatz4000 - February 27, 2007 - 14:17
Status:patch (code needs review)» patch (reviewed & tested by the community)

#2

drumm - February 27, 2007 - 19:43
Version:5.1» 6.x-dev
Status:patch (reviewed & tested by the community)» patch (code needs work)

I bet the search form causes this on a few pages with 'edit-submit'. I'd think we would want to change the search form instead.

What form is creating a second 'edit-name'?

#3

samo - February 28, 2007 - 01:19

the search block and the user login block will both use the same ids as the contact form uses.

You can also break XHTML validation by just including the search block and the user login block.

#4

gagarine - December 18, 2007 - 14:43

A temporary solution for contact and search: http://drupal.org/node/111719#comment-663318

#5

Arancaytar - January 25, 2008 - 18:11

Speaking of which, why didn't the above issue solve the problem once and for all, centrally? I recall that code was committed to Form API in the end. If we're already rendering forms centrally, then we could also centrally take care that ids are either "uniquified" or custom ids are simply prohibited, with ids always being auto-generated. This could be an API change, but broken XML wellformedness (not the same as XHTML validity) is quite a critical bug.

#6

dsp1 - February 7, 2008 - 12:16

subscribing.

will there be a back port to 5.x?

tried to test if it is actually fixed in D6-rc3 but the search form is disappearing for the anonymous user even though the block is set correctly.

#7

Arancaytar - February 7, 2008 - 12:22

the search form is disappearing for the anonymous user even though the block is set correctly.

Grant the permission "search content" to the anonymous user in admin/user/permissions.

Edit: I just did, and it is indeed fixed. Search form gets an "edit-submit-1" ID.

#8

dsp1 - February 7, 2008 - 12:39

thanks for the fast response. i am sleepy so did not even think about the permissions on my D6 test system.

i tested and yes it is fixed for D6. great!

what about D5 back port?

#9

Arancaytar - February 7, 2008 - 12:49

And what about edit-name?

#10

dsp1 - February 7, 2008 - 23:55

looks ok. i only see two id's when login and search are shown.
id="edit-name"
id="edit-name-wrapper"

#11

cbovard - June 3, 2008 - 22:58

I found the best fix for this here: http://drupal.org/node/243249
Very simple.

 
 

Drupal is a registered trademark of Dries Buytaert.