Hi all,
I have a form like this :
<div class="row">
<?php echo $form->labelEx($model,‘jnsKelamin’); ?>
<?php echo $form->radioButton($model,‘jnsKelamin’,array(‘value’=>‘Male’)) . ‘Male’; ?>
<?php echo $form->radioButton($model,‘jnsKelamin’,array(‘value’=>‘Female’)) . ‘Female’; ?>
<?php echo $form->error($model,‘jnsKelamin’); ?>
</div>
Why if I choose Male, the value = 0,
instead female value is correct = Female ?
Thanks,
Any help will be highly appreciated.
devjam
(Devjam)
July 22, 2010, 11:55am
2
why you are not using radioButtonList
hi, thanks for your suggestion, but after I tried radioButtonList, I was succesfully to use it, but get the result in vertical mode, how to make it appear in horizontal mode.
Here are my codes ;
<?php
$accountStatus = array('Male'=>'Male', 'Female'=>'Female');
echo $form->radioButtonList($model,'jnsKelamin',$accountStatus,array('separator'=>' '));
?>
thanks anyway.
yiippy
(Smartgdi)
August 5, 2010, 6:53am
4
I get the same case. How to make it vertically?
andy_s
(Arekandrei)
August 5, 2010, 8:19am
5
Hello!
This is my first post in Yii, so, hello everybody.
It’s been three days now that I’m trying to solve what “jimmi nababan” said:
Why if I choose Male, the value = 0,
instead female value is correct = Female ?
I need to use RadioButton, not radioButtonList because i’m using one radiobutton option inside of an Accordion component, and the other outside, so, it can’t be a list.
I’m really worried for these, since I can’t go on with the project without this. I have read EVERYTHING I’ve find, and no solutions…
Any ideas?
Thank you!
zaccaria
(Matteo Falsitta)
December 8, 2010, 9:32am
7
You have to use radio button list.
If you use 2 radio button, the second (female) will override the value of the first.
Use radio button list + css for put them horizotally. Take a look at this.
zaccaria
(Matteo Falsitta)
December 8, 2010, 9:33am
8
P.S: welcome to the forum jdl!
Hello Zaccaria,
Thank you very much for your fast response. I think I can’t do what I want with styling. I have added an image to show what I’d like to do:
1014
capture.JPG
I am using the Jui Accordion Yii component, to show the rest of available radiobuttons, and the first one out of it…
jdominguez
(Jdomin123)
December 8, 2010, 8:23pm
10
Ok,
I’ll try styling that way…
Thank you!
za_al
(Zakieh Alizadeh)
July 2, 2012, 10:11am
11
for vertically:
<?php
$accountStatus = array('Male'=>'Male', 'Female'=>'Female');
echo $form->radioButtonList($model,'jnsKelamin',$accountStatus,
array('separator'=>' ',
'labelOptions'=>array('style'=>'display:inline'), // add this code
));
?>
poyzn
(Ipoyzn)
June 17, 2013, 2:28pm
12
Hello,
I have 3 radiobuttons in a row. I need to decorate each of them individually. How can I do it using radiobutton list?
And why Yii inserts additional empty radiobutton inputs? I have problem with form serialization and parsing its values
Thanks.
1 Like
Any other responses? display:inline isn’t working for me.