Looking at the node form's page source, three different divs have the same ID, which would seem to be a problem for CSS:

<fieldset class=" collapsible collapsed"><legend>Comment settings</legend><div class="form-radios"><div class="form-item" id="edit-comment-wrapper">
 <label class="option"><input type="radio" name="comment" value="0"  checked="checked"  class="form-radio" /> Disabled</label>
</div>
<div class="form-item" id="edit-comment-wrapper">
 <label class="option"><input type="radio" name="comment" value="1"   class="form-radio" /> Read only</label>
</div>
<div class="form-item" id="edit-comment-wrapper">
 <label class="option"><input type="radio" name="comment" value="2"   class="form-radio" /> Read/Write</label>

</div>
</div></fieldset>

suggests a bug in the Forms APi.

Comments

anders.fajerson’s picture

admin/user/settings is another example where radios is affected. The IDs "edit-user-register-wrapper", "edit-user-signatures-wrapper", "edit-user-pictures-wrapper" are defined multiple times.

Probably this code is to blame (line 1906 in form.inc):

function theme_form_element($element, $value) {
  $output  = '<div class="form-item"';
  if (!empty($element['#id'])) {
    $output .= ' id="'. $element['#id'] .'-wrapper"';
  }
...
pwolanin’s picture

Title: FAPI3 - duplicate Id values for form elements » FAPI3 - duplicate id values for form elements
Status: Active » Needs review
StatusFileSize
new1.07 KB

hmm, I am having a hard time figuring out why the #id is set correctly for checkbox elements but not radio elements. However, attached patch fixes the bug at least.

chx’s picture

StatusFileSize
new1021 bytes

That's quite a bit sketchy. I would do this instead.

pwolanin’s picture

StatusFileSize
new2.27 KB

fixed parse error and added the same code for filter module's radio elements. Note - we always want to use the parents - otherwise the id may not be unique - essentially this is the same as setting #tree to TRUE, which expand_checkboxes() does in that case.

Seems to fix the problem.

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Before the patch: admin/user/settings reports 4 XHTML violations.

After patch, it reports zero.

Extra bonus: Form still works! ;)

RTBC. :)

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)