I need to display a single radio button at the end of each row of a
table. Each row pertains to a candidate in an election, and there are
several groups of rows, one for each office.

I've got single buttons working, and it looks like I got the group
thing correct. But the submitted data looks wrong.

$office_cnt is incremented after each outer loop (office), and there's
an inner loop for each candidate.

<?= $form->radio(
        "ElectionVote.${office_cnt}",
        array($ballot['id'] => ''),
        array(
                'label' => false,
                'legend' => false
        )
) ?>

An example from the 1st group:
<input type="hidden" name="data[ElectionVote][0]" id="ElectionVote0_"
value="" />
<input type="radio" name="data[ElectionVote][0]" id="ElectionVote02"
value="2"  />

2nd group:
<input type="hidden" name="data[ElectionVote][1]" id="ElectionVote1_"
value="" />
<input type="radio" name="data[ElectionVote][1]" id="ElectionVote17"
value="7"  />

Is this correct? Because, after selecting one button from each group,
the submitted data looks like, eg:

Array
(
    [ElectionVote] => Array
        (
            [0] =>
            [1] => 9
            [2] =>
            [3] =>
            [4] =>
        )
)

There's never more than a single value, it's always in a different
place in the array, and sometimes the array is completely empty. The
markup looks correct to me. Am I wrong?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to