views:

614

answers:

1

I have been looking at the cookbook - 7.3.3 Automagic Form Elements trying to find a way for radio buttons to line up horizontally rather than vertical. I have been looking at the 'div' => 'class_name' $options also the "$options[‘between’], $options[‘separator’] and $options[‘after’]" but have been unsuccessful. Is there a "cake" way of doing this?

<?=$form->input('Product Type', array(
     'type' => 'radio',
     'id' => $tire['ProductType']['id'],
     'name' => $tire['ProductType']['id'],
     'options' => array(2=>'Tire Manufacturer', 7=>'Rim Manufacturer '),

));?>

The of equivalent this

<label>Product Type</label>
<div style="padding-top:5px;">
    <input type="radio" name="data[Manufacturer][product_type_id]" value="<?=$tire['ProductType']['id']?>"> Tire Manufacturer &nbsp;&nbsp;
    <input type="radio" name="data[Manufacturer][product_type_id]" value="<?=$wheel['ProductType']['id']?>"> Rim Manufacturer
</div>
A: 

The easiest way to do this is to put each radio button inside an 'LI' tag, and then apply CSS styles to the 'UL' that tells it to show 'LI' tags horizontally instead of vertically. You can find a lot of horizontal list designs here.

Mike Trpcic
Thanks for the answer Mike. I still haven't found a "cake" way of doing this so I just went with with a checkbox.
Stirling