This issue occurs on default install of Drupal 5.15. Creating a radios form element and assigning it an id will assign the same id to all radios, creating invalid (x)html and creating issues for scripting.
The expected behaviour would be that the radios were enclosed in a container div, with the assigned id, and each child elements would be assigned a unique id based upon parent id and return value.
This has been rolled into D6 and it would be good to get these changes backported, although I notice that in the D6 version of this function the container element would not be assigned any id, making it slightly less useful for creating selectors in css/js.
Comments
Comment #1
gollyg commentedHave added a patch against D5.15 based upon changes in D6..
Have tested with clean install by reviewing the code output in garland for a set of radios.
This is my first patch and, whilst having read the patch docs, I have no doubt done something wrong. Be gentle...
Comment #2
gollyg commentedOkay, so the first patch created correct wrapper ids for the elements, but left the inputs themselves with duplicate ids.
This next patch checks to see if the id has been set in the #attributes string and, if so, assigns the modified id to the element for further processing.
Comment #3
gollyg commentedMarking this for review, as it is working on my site without issues.
Comment #4
drummCommitted #1 to Drupal 5 because it is a straight backport.
The additional change in #2 needs review against the most recent affected version and then backporting as necessary. The comment does need to be punctuation and capitalization like an English sentence.
Comment #5
gollyg commentedChanged the capitalisation and punctuation to normal English.
Updated patch to apply to 5.16.
Not sure what backporting to other versions involves?
Comment #6
gollyg commentedAh, so i should have patched against 7?
Comment #7
drummYes, changes need to go into the development version and then backported as needed.
Comment #8
gollyg commentedCool, will do that soon.
Comment #9
effulgentsia commentedThis looks fixed to me in D7. Re-open if I'm wrong.