With the emergence of jQuery in core, it would be extremely useful if all buttons have a proper ID associated with them. This can make it easier to add various AJAX effects, form handlers, and so forth.

CommentFileSizeAuthor
#4 d_11.patch1.2 KBm3avrck
#1 d_10.patch1.12 KBm3avrck
d_9.patch925 bytesm3avrck
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m3avrck’s picture

FileSize
1.12 KB

Here's a better patch that won't override the ID for the button if it has been set somewhere else.

Steven’s picture

Status: Needs review » Needs work

Id's have a very restricted set of allowed characters. drupal_strtolower does not suffice. We have a form_clean_id() function, but I believe it expects name="" attribute values (i.e. only underscore, dash and brackets are removed).

Steven’s picture

.. and I think form API already assigns an ID automatically in #id (not #attributes > #id).

m3avrck’s picture

FileSize
1.2 KB

Simplified after talking with Steven.

m3avrck’s picture

Status: Needs work » Needs review
Steven’s picture

Status: Needs review » Fixed

Committed to HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)