Ticket #37 (new defect)

Opened 2 years ago

Last modified 3 months ago

Generated Radio Button elements have identical IDs

Reported by: clay@… Owned by: pmjones
Priority: major Component: code
Keywords: Cc:

Description

Radio button elements have identical CSS ids, which violates the "ids must be unique" rule of XHTML.

<?php
$form->elements['foo[bar]']['type'] = 'radio';
$form->elements['foo[bar]']['options'] = array(
    1 => $this->locale('RADIO_YES'),
    0 => $this->locale('RADIO_NO'),
);
?>

Will result in something similar to:

<label><input type="radio" name="foo[bar]" value="1" id="foo-bar" class="input-radio foo-bar require" />Yes</label>
<label><input type="radio" name="foo[bar]" value="0" id="foo-bar" class="input-radio foo-bar require" checked="checked" />No</label>

For XHTML that will validate, the output should probably be something similar to:

<label><input type="radio" name="foo[bar]" value="1" id="foo-bar-1" class="input-radio foo-bar require" />Yes</label>
<label><input type="radio" name="foo[bar]" value="0" id="foo-bar-2" class="input-radio foo-bar require" checked="checked" />No</label>

(I'd make this little change myself, but I'm not sure of the state of the current trunk vs. branch.)

Attachments

Add/Change #37 (Generated Radio Button elements have identical IDs)

Author



Action
as new
 
Note: See TracTickets for help on using tickets.