activeForm设置默认值input:<?= $form->field($model,'code')->label('国别码')->input('text',['value'=>'ceshi']); ?>CheckBox:先在控制器中设置 $model->type = 1再在视图中<?= $form->field($model,'type')->dropDownList(['1'=>'best','2'=>'better','3'=>"well"],['prompt'=>'请选择']); ?>dropDownList先在控制器中设置 $model->items = 'a';再在视图中<?= $form->field($model, 'items')->checkboxList(['a' => 'Item A', 'b' => 'Item B', 'c' => 'Item C']);?>
查看原文:http://www.architecy.com/archives/377
YII2在使用activeForm设置默认值
最新推荐文章于 2021-03-18 00:23:45 发布