When rendering an activeRadioButtonList like so
<?php echo CHtml::label($model->getAttributeLabel('effect'), 'itemGroup-Condition_effect'); ?>
<?php echo $form->radioButtonList($model, 'effect', Condition::$effects, array('id' => 'itemGroup-Condition_effect', 'class' => 'sharedInput', 'separator' => ' ', 'uncheckValue' => null)); ?>
The output looks like this
<div id="itemGroup-effect" class="row conditionHolder">
<label for="itemGroup-Condition_effect">Effect</label>
<span id="Condition_effect">
<input id="Condition_effect_0" class="sharedInput" value="boost" type="radio" name="Condition[effect]" />
<label for="Condition_effect_0">Boost</label>
<input id="Condition_effect_1" class="sharedInput" value="blacklist" checked="checked" type="radio" name="Condition[effect]" />
<label for="Condition_effect_1">Blacklist</label>
<input id="Condition_effect_2" class="sharedInput" value="defaults" type="radio" name="Condition[effect]" />
<label for="Condition_effect_2">Default</label>
<input id="Condition_effect_3" class="sharedInput" value="overrides" type="radio" name="Condition[effect]" />
<label for="Condition_effect_3">Whitelist</label>
</span>
</div>
It seems like the ‘id’ field specified in the htmloptions of the activeradiobuttonlist is overwritten. Is there any way to specify your own id or prepend an id prefix to the span and radio button input fields?
My use case is I am rendering the same model fields more than once in the same form and showing/hiding them using jquery based on other selections in the form. The existing model field values won’t show as checked because there are duplicate ids on the page
Thanks