The 'if' tests for title and id seem to be inverted in theme_form_element. Note if there is no title then the code never emits a for= for the id.
This function lives in theme.inc.
The 'if' tests for title and id seem to be inverted in theme_form_element. Note if there is no title then the code never emits a for= for the id.
This function lives in theme.inc.
Comments
Comment #1
quicksketchHere's the offending code from 4.7.4:
It looks okay to me. If there isn't a title, then it can't generate a label at all. If there is a title, but not an "id" attribute, then the label tag is generated but doesn't include a
for="id-of-element-here". Is this not the problem described?Comment #2
bmargulies commentedIf there's no title, why not put the id on what gets created? Here's what I put in my theme, since lots of elements in a webform end up title-less (like checkboxes). I confess that I'm not at all clear on what the use of the 'for' attribute is in a label.
Comment #3
bmargulies commentedSorry, I should also have noted that you correctly diagnosed that my complaint was not well-formed. I should have titled 'if you can't id a label, how about id-ing the div'?
Comment #4
walkah commentedComment #5
Freso commentedIs this still applicable in latest HEAD? (Or in Drupal 5 or 6?)
Comment #6
johnalbinThis has already been fixed. See http://api.drupal.org/api/function/theme_form_element/7
Comment #7
johnalbinActually, I should say this is a duplicate. Of what, I don't know.