aruna470
(Aruna470)
January 17, 2012, 4:17am
1
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
dniznick
(Dniznick)
January 17, 2012, 1:08pm
2
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?
aruna470
(Aruna470)
January 18, 2012, 1:17am
3
dniznick:
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.
22francis
(Jesusloves Francis)
February 1, 2012, 8:40pm
4
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…
misc
(Haibhoang)
April 23, 2012, 8:43pm
5
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.