activeRadioButtonList()

Hi

I'm trying to build a radio button list, however it is not just a straight forward list, some of the radio buttons have text fields next to them for a user to complete if that radio button is selected.

Obviously a activeRadioButtonList() generates a list, which is great, but I need to be able to generate a list manually using activeRadioButton() so I can place the form elements I need to after each individual radio button.

It would need to look like the attachment.

I can't see a way of achieving this using the activeRadioButtonList or activeRadioButton as it seems activeRadioButton is just for 1 radio button that's not part of a list of radio buttons?

Is there a way to achieve this or should I just use html instead (which kinda negates the use of a model and makes my life much harder)

Chris

For this kind of complex inputs, you should work on your own. ;)

oks, but what wuld be great for the future would be the ability to place radio buttons anywhere using activeRadioButton  with ability to tie them together into a list through the model :)

I came across the same issue and have been looking for a solution.

This seems to do the trick:




<?php $radio_options = CHtml::activeRadioButtonList($job,'jobType',$jobTypes, array('template'=>'{input}{label}','separator'=>'|'));

$radio_options = explode('|',$radio_options);

?>

<?php echo $radio_options[0] ?>

Details and stuff

<?php echo $radio_options[1] ?>

Details and more stuff

<?php echo $radio_options[2] ?>

Details and different stuff



I have the same question!