forms - yii2 remove optgroup from dropdownlist -


how can remove optgroup checkbox field

<?= $form->field($model, 'survey_type')->dropdownlist([$surveytypelist],['prompt'=>'select survey type','id'=>'survey_type_dropdown']) ?> 

provides following html

<label class="control-label" for="survey_type_dropdown">type</label> <select id="survey_type_dropdown" class="form-control" name="surveys[survey_type]"> <option value="">select survey type</option> <optgroup label="0"> <option value="2d">2d</option> <option value="3d">3d</option> </optgroup> </select>  <div class="help-block"></div> 

you have send $survytypelist variable, not array.

just remove [].


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -