Details
Description
ExampleForm.php
$this->addElement('radio', 'test', array(
'label' => 'test',
'multiOptions' => array('Mr' => 'Mr','Ms' => 'Ms','Miss'
=> 'Miss','Mrs' => 'Mrs'),
));
output.html
//generated output <dt id="test-label"><label disablefor="1" class="optional">test</label></dt> <dd id="test-element"> <label for="test-Mr"><input name="test" id="test-Mr" value="Mr" type="radio">Mr</label> <br><label for="test-Ms"> <input name="test" id="test-Ms" value="Ms" type="radio">Ms</label><br> <label for="test-Miss"> <input name="test" id="test-Miss" value="Miss" type="radio">Miss</label><br><label for="test-Mrs"> <input name="test" id="test-Mrs" value="Mrs" type="radio">Mrs</label></dd>
<label disablefor="1" class="optional">: 'disablefor' is not valid (X)HTML attribute in any case.
Proposed fix:
Index: FormLabel.php
===================================================================
--- FormLabel.php (revision 19018)
+++ FormLabel.php (working copy)
@@ -54,9 +54,13 @@
}
$value = ($escape) ? $this->view->escape($value) : $value;
- $for = (empty($attribs['disableFor']) || !$attribs['disableFor'])
- ? ' for="' . $this->view->escape($id) . '"'
- : '';
+ if (empty($attribs['disableFor']) || !$attribs['disableFor']) {
+ $for = ' for="' . $this->view->escape($id) . '"';
+ }
+ else {
+ $for = '';
+ unset($attribs['disableFor']); //Remove $attribs['disableFor'] from array
+ }
// enabled; display label
$xhtml = '<label'
What is the outcome you had expected, and how do you propose to solve this (without losing functionality, while generating valid html for other versions)?