views:

9

answers:

1

Not really sure how to frame this question, so bear with me. On my form, I have categories with multiple fees. I want the categories to be a header or caption with the fees rendered as radio buttons like

Category1
rb1 feeName-feeAmount rb2 feeName-feeAmount

Category2
rb1 feeName-feeAmount rb2 feeName-feeAmount

I have the radio buttons rendered correctly, but cannot seem to get the categories to appear as text. I tried setLabel() but that failed.

Here's the code to perform that task:

        foreach ($categoryData as $categoryRow) {

// $categories->setLabel('categories'); -- part that doesn't work

echo $categories['description'];

            foreach ($feeData as $feeRow) {
                if ($feeRow['categories_idCategory'] == $categories['idCategory']){
                    $fees->setLabel('Fees:')
                        ->setSeparator(' ')
                        ->addMultiOption($feeRow['amount'] . '-' . $feeRow['name'], $feeRow['amount'] . '-' . $feeRow['name']);
                }
            }
        }

So, I can echo the category description, but it renders outside of the tag, thus rendering it after the form elements. Not good.

Can someone explain how I can get the category to appear as a label for the radio button arrays?

If my explanation is unclear, please feel free to ask.

Thanks.

A: 

I figured it out. I had to convert the setLabel() parameter to a string. The result in code looks like this:

$categories->setLabel(strval($categoryRow['description']));
Mike

related questions