While the forms API properly creates for/id pairs for the radio buttons and their individual labels the label for the group label are given a "for" attribute without a matching id creating validation errors and potential accessibility issues.


Note from my fellow developer:

It’s a problem with the Form API. When you use ‘radio’ as the type of the control, it wraps all of the radio options in a div and gives that div the id that matches the for attribute of the label, so it freaks out that it doesn’t match a form element. The radio form elements each get the id that match their array key. So, in this case the form api element is keyed as ‘repeats’ and the radio options are keyed as ‘weekly’, ‘monthly’, and ‘yearly’, so the label gets a for attribute of ‘edit-repeats’, the div wrapper gets an id of ‘edit-repeats’, and each radio option gets an id of ‘edit-repeats-weekly’, ‘edit-repeats-monthly’, ‘edit-repeats-yearly’.


mgifford’s picture

Status: Active » Closed (duplicate)