Using variable strings in a dropdownlist


i am currently looking at a project that needs a custom field being input to a form that needs it’s style updated to the bootstrap style buttons etc.

The issue I’m having is that with the way the code is set up, It is bringing up errors for the form.

     $attr['formname'] = $this->model_name . '_' . $attr['name'];

            $attr['htmlOptions'] = array('class' => 'span5', 'placeholder' => $attr['name']);

            $attr['htmlOptions']['class'] .= ' form-control';


            if ($attr['required'] === 1){

                $attr['requiredfields'] = array('required' => true);


                $attr['requiredfields'] = '';


    echo $form->dropDownListGroup(




                                           'wrapperHtmlOptions' => array(

                                               'class' => 'col-sm-5',


                                           'widgetOptions' => array(

                                               'data' => array($items,





This brings up an error but if I use the default styling without any of the yiibooster functionality this works.

echo CHtml::dropDownList($attr['formname'], $attr['value'], array($items));

What am I missing here?

The error is literally “hasErrors” function in the activeform file. There isn’t an issue with the form declaration or anything like that, I presume it’s just how the widgetoptions handles the array.

It could be due to the following reason.

The first parameter for $form->dropDownListGroup should be a model, not a model name.


echo $form->dropDownListGroup(