using radio button group

Hi,

I want to create a form as shown in the attachment.The problem is selected radio button value is not submitting.Radio buttons are added as below.In this situation I cant use radio button list.


echo $form->radioButton($model, 'voice_greet_type', array('value' => UserProfile::DEFAULT_GREET)) . ' Default Greeting';


echo $form->radioButton($model, 'voice_greet_type', array('value' => UserProfile::ALL_DAY_GREET)) . ' All Day Greeting';


echo $form->radioButton($model, 'voice_greet_type', array('value' => UserProfile::TIME_DEPENDENT_GREET)) . ' Time Dependent Greeting';


echo $form->radioButton($model, 'voice_greet_type', array('value' => UserProfile::OTHER_GREET)) . ' Other Greeting';

Thanks

Aruna

So when you submit the form the radio choices are not part of the POST array?

Do you have a validation rule for your choices?

Why can’t you use a radiobutton list instead?

Thanks for the replay.

radio choices are not part of the POST array? they submitted but no selected value is there.

Do you have a validation rule for your choices? yes

Why can’t you use a radiobutton list instead? my radio buttons are positioned in various places in the form not in one place.

Anyway I solved it as below


$greet_type_options = explode('|',

	$form->radioButtonList($model, 

		'greet_type', 

		array(

			$model::DEFAULT_GREET => 'Default', 

			$model::ALL_DAY_GREET => 'All Day', 

			$model::TIME_DEPENDENT_GREET => 'Time Dependent',

			$model::OTHER_GREET => 'Other'), 

		array(

			'template'=>'{input}',

			'separator'=>'|'))

);


echo $greet_type_options[0];

echo $greet_type_options[1];

like wise I get the single radio button and place it where I want.




echo $form->radioButton($model, 'voice_greet_type', array('value' => UserProfile::DEFAULT_GREET,'uncheckValue'=>null)) . ' Default Greeting';


echo $form->radioButton($model, 'voice_greet_type', array('value' => UserProfile::ALL_DAY_GREET,'uncheckValue'=>null)) . ' All Day Greeting';


echo $form->radioButton($model, 'voice_greet_type', array('value' => UserProfile::TIME_DEPENDENT_GREET,'uncheckValue'=>null)) . ' Time Dependent Greeting';


echo $form->radioButton($model, 'voice_greet_type', array('value' => UserProfile::OTHER_GREET,'uncheckValue'=>null)) . ' Other Greeting';



just add ‘uncheckValue’=>null in htmlOption array

it will work…

This sugguestion kicks ass. Really helpful.