Yii Framework Forum

Displaying elements of radioList


(Kipp Thomas) #1

hi guys,

following code will display elements of radioListe among themseleves(Look at my attachement,please). My intention is to get placed these elements paralell.

Any ideas how to change code?





<div class="col-md-4"><?=

$form->field($model_person, 'id_personentyp_dominant')->radioList([1 => 'Typ Rot', 2 => 'Typ Grün', 3 => 'Typ Blau'], array('labelOptions' => array('style' => 'display:inline'), 'separator' => '  ',

));

 ?></div><div class="col-md-4"><?=

 $form->field($model_person, 'id_personentyp_peripher')->radioList([1 => 'Typ Rot', 2 => 'Typ Grün', 3 => 'Typ Blau'], array('labelOptions' => array('style' => 'display:inline'), 'separator' => '  ',

));

?></div><div class="col-md-4"><?=

$form->field($model_person, 'id_personentyp_defizit')->radioList([1 => 'Typ Rot', 2 => 'Typ Grün', 3 => 'Typ Blau'], array('labelOptions' => array('style' => 'display:inline'), 'separator' => '  ',

));

?></div>




(4ernikoff) #2

$form->field($model_person, 'id_personentyp_dominant')->radioList([1 => 'Typ Rot', 2 => 'Typ Grün', 3 => 'Typ Blau'], array('labelOptions' => array('style' => 'display:inline'), 'separator' => '  ',

))->inline(true);


(Kipp Thomas) #3

Ohhh, it’s yours again I remember yours very well fixing my bugs a lot of time.

Unfortunately, this time, ur suggestion won’t fix my bug. I will get following Exception using inline(true)




yii\base\UnknownMethodException: Calling unknown method: kartik\form\ActiveField::inline() 



Apart from this, I already use




array('labelOptions' => array('style' => 'display:inline'), 'separator' => '  ')



which is ineffective for ActiveForm of kartik, as it seems…


(Kipp Thomas) #4

I tried solving problem like this, but didn’t succeed with it

[list=1][]closing ActiveForm before attributes beeing placed paralell[]Defining new ActiveForm as below[]Closing new ActiveForm[]Redefining ActiveForm as usual[/list]





$form = ActiveForm::begin([

            'id' => 'dynamic-form',

            'type' => ActiveForm::TYPE_INLINE,

            'formConfig' => [

                'showLabels' => true

        ]]);



P.S.: This solution is no option,'cause there are too many <div>-tags,which prevent this way!

Thread can be closed…


(diggymo) #5

tklustig

Are you using yii\widgets\ActiveForm;?

I’m work for using yii\bootstrap\ActiveForm;.


(David799) #6

I am struggling with the same thing. I’ve tried setting CliendIDMode to Static, in hopes that would make it possible for me to set the display style via a class and applying that class with CssClass, but that didn’t work. My RadioButtonList still displays like the original posted wrote myprepaidcenter.