external form - bug in auto increment id of radio buttons?

Permalink
I'm external forms newbie and I noticed unexpected behaviour in radio buttons auto increment ids, if form has more than one radio groups. I think the id or radio input should start always from 1 in different groups, but it seems that it doesn't reset between different groups.

Here is quick example what I tried to do, but "Slow" and "Fast" labels don't work as they're for speed1 and speed2 instead of speed3 and speed4.

Code:
<fieldset>
    <legend><?php echo t("Dog breeds")?></legend>
    <?php echo $form->label('dog1', 'Doberman Pinscher'); ?>
    <?php echo $form->radio('dog', 'Doberman Pinscher'); ?>
    <br />
    <?php echo $form->label('dog2', 'Rottweiler'); ?>
    <?php echo $form->radio('dog', 'Rottweiler'); ?>
    <br />
</fieldset>
<fieldset>
    <legend><?php echo t("Speed")?></legend>
    <?php echo $form->label('speed1', 'Slow'); ?>
    <?php echo $form->radio('speed', 'Slow'); ?>
    <br />
    <?php echo $form->label('speed2', 'Fast'); ?>

Output:
<?php /* c5 forum, please don't add php opening automatically */ ?>
<fieldset>
  <legend>Dog breeds</legend>
  <label for="dog1">Doberman Pinscher</label>
  <input type="radio" class="ccm-input-radio" name="dog" id="dog1" value="Doberman Pinscher"  /><br />
  <label for="dog2">Rottweiler</label>
  <input type="radio" class="ccm-input-radio" name="dog" id="dog2" value="Rottweiler"  /><br />
</fieldset>
<fieldset>
  <legend>Speed</legend>
  <label for="speed1">Slow</label>
  <input type="radio" class="ccm-input-radio" name="speed" id="speed3" value="Slow"  /><br />
  <label for="speed2">Fast</label>
  <input type="radio" class="ccm-input-radio" name="speed" id="speed4" value="Fast"  /><br />
</fieldset>


Am I doing something wrong or is it a bug?

orisinal
 
synlag replied on at Permalink Reply
synlag
Well, this seems like a bug, as the form helper in concrete/helpers/form.php increments the radioIndex for each radio button you're using.