[Catalyst] HTML::Widget - checkboxes with same name, duplicate id-attributes

ADSJ (Adam Sjøgren) adsj at novozymes.com
Mon Mar 20 10:53:11 CET 2006


  Hi.


If I create several checkboxes with the same name, like this:

 $w->element('Checkbox', 'choose')->label('One thing')->value(1);;
 $w->element('Checkbox', 'choose')->label('Another thing')->value(2);

The resulting XHTML contains duplicate id-attributes:

 <label for="widget_choose" id="widget_choose_label">
   <input class="checkbox" id="widget_choose" name="choose" type="checkbox" value="1" />
   One thing
 </label>
 <label for="widget_choose" id="widget_choose_label">
   <input class="checkbox" id="widget_choose" name="choose" type="checkbox" value="2" />
   Another thing
 </label>

The HTML-specification allows checkbox-elements to share the same
name¹, so I guess Checkbox.pm ought to do something similar to
Radio.pm for id-attributes?


  Best regards,

    Adam


¹ <http://www.w3.org/TR/html4/interact/forms.html#checkbox>

-- 
                                                          Adam Sjøgren
                                                    adsj at novozymes.com



More information about the Catalyst mailing list