bleu
(Zend W)
1
I am using
<?php echo $form->labelEx($memberdetails,'gender'); ?>
<?php echo $form->radioButtonList($memberdetails,'gender',array(1=>'Male',2=>'Female')); ?>
<?php echo $form->error($memberdetails,'gender'); ?>
<div class="row">
<label for="Details_gender">Gender</label> <input type="hidden" name="Details[gender]" value="" id="ytDetails_gender"><input type="radio" name="Details[gender]" value="1" id="Details_gender_0"> <label for="Details_gender_0">Male</label>
<br>
<input type="radio" name="Details[gender]" value="2" id="Details_gender_1"> <label for="Details_gender_1">Female</label>
</div>
I do not want the <br> tag to come but I want both of them to be in the same line
How Can I achieve this?
mdomba
(Maurizio Domba Cerin)
2
check the documentation for the radioButtonList - http://www.yiiframework.com/doc/api/1.1/CHtml#radioButtonList-detail
The htmlOptions parameter has additional options like "template" and "separator"… if not defined the default separator is "br"
dckurushin
(Diavolonok)
4
it is dirty solution, but if you don’t know you always can use str_replace
just did it today with dropDownList to cut out the \n
You can use separator of html options
echo $form->radioButtonList($model,‘radioname’, $model->getradioarray(),
array( 'labelOptions'=>array('style'=>'display:inline;width:150px;'), 'template'=>"{input} {label}", [b]'separator'=>'&nbsp;&nbsp;&nbsp;'[/b]));
If you don’t want the <br/> tag in between radio items, you can use the separator option.
eg. -
echo $form->radioButtonList($memberdetails,'gender',
array('m'=>'Male','f'=>'Female'),array('separator'=>''));
This way the seperator will render as an empty string.