Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6.0
-
Fix Version/s: 1.11.8
-
Labels:None
Description
$form = new Zend_Form();
$form->addElement('radio', 'myName', array(
'value' => '-1',
'multiOptions' => array(
'inherit' => 'inherit',
-1 => 'reset',
1 => 'allow',
0 => 'deny',
),
));
$form->populate(array('myName' => 'inherit'));
echo $form;
Generated xhtml:
<label style="white-space: nowrap;">
<input type="radio" name="myName" id="myName-inherit" value="inherit" checked="checked" />inherit
</label><br />
<label style="white-space: nowrap;">
<input type="radio" name="myName" id="myName-1" value="-1" />reset
</label><br />
<label style="white-space: nowrap;">
<input type="radio" name="myName" id="myName-1" value="1" />allow
</label><br />
<label style="white-space: nowrap;">
<input type="radio" name="myName" id="myName-0" value="0" checked="checked" />deny
</label>
has two elements with same id "myName-1" (options "-1" and "1"). Also "0 => 'deny'" option is selected, but I have populated form with "'myName' => 'inherit'". Also "0 => 'deny'" option will be selected by default, but I set default "'value' => '-1'".
Patch to fix the issue. The problem was that dashes were filtered from the id through the use of the alnum filter. In the patch a regex is used to allow both alphanumeric characters and dashes.