The current cvs implementation of the user block
define twice the attribute id.

Once on line 527:

$form['#attributes'] = array('id' => 'user-login-form');

Once on line 538:

$output .= drupal_get_form('user_login_block', $form, 'user_login');

Calling drupal_get_form that way will make user_login_block an id for the form.
But there has been yet an assignement to the attribute id using $form['#attributes']

Note that this problem make drupal xhtml not w3 compilant.

Fabio

CommentFileSizeAuthor
#11 user_login_id.patch618 byteschx
#8 double_ids_patch1.09 KBfax8
user.module.w3.patch1.27 KBfax8

Comments

dries’s picture

We are currently generating this:

<form action="/node?destination=node" method="post" id="user_login_block" id="user-login-form">

We probably want to keep "user-login-form".

The patch is somewhat strange because the other drupal_get_form()s use underscores not dashes. However, our CSS coding conventions require dashes, not underscores. Argh.

fax8’s picture

Dries... probably I didn't understood... but the patch do exactly
what you asked: remove user_login_block and keep user-login-form

But I can be wrong :-)

dries’s picture

Yes, but I'm not sure it is safe/consistent to use dashes for the first paramater of drupal_get_form(). We might have to use underscores.

fax8’s picture

what about changing

$form['#attributes'] = array('id' => 'user-login-form');

to

$form['#attributes'] = array('class' => 'user-login-form');

and leave underscores on drupal_get_form ?

$output .= drupal_get_form('user_login_block', $form, 'user_login');

themes that use #user-login-form will need to change .user-login-form

moshe weitzman’s picture

Status: Needs review » Closed (duplicate)

the last comment was implemented in a patch for http://drupal.org/node/11031

fax8’s picture

Status: Closed (duplicate) » Active

there is no patch for this issue on http://drupal.org/node/11031

moshe weitzman’s picture

sorry, i lost my patch. #4 looks sane to me.

fax8’s picture

Status: Active » Needs review
StatusFileSize
new1.09 KB

patch for #4. Also changes misc/drupal.css to use .user-login-form instead of #user-login-form .

Note that with this patch every theme that override #user-login-form in their css will need to be
changed to use .user-login-form .

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community
fax8’s picture

Marking http://drupal.org/node/48929 duplicate of this issue.

chx’s picture

StatusFileSize
new618 bytes

Form API now tolerates the #id you set if you do not set it directly. See patch.

fax8’s picture

perfect! this is ok for me. good work.

fax8’s picture

Also note that this doesn't break any theme.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)