use common\models\School; $this->title = $model->isNewRecord ? '添加营业点用户' : '更新营业点用户'; ?> <div class="row"> <div class="col-lg-6"> <?php $form = ActiveForm::begin(['enableAjaxValidation' => true, 'options' => ['autocomplete' => 'off']]); ?> <div class="form-group"> <label class="control-label">学校</label> <?php echo Html::dropDownList('school', $model->isNewRecord ? '' : $model->store->school_id, School::getKeyValuePairs(), ['class' => 'form-control']); ?> </div> <?php echo $form->field($model, 'store_id')->dropDownList($model->isNewRecord ? [] : Store::getKeyValuePairs($model->store->school_id)); ?> <?php echo $form->field($model, 'username')->textInput(['autocomplete' => 'off']); ?> <?php echo $form->field($model, 'password')->passwordInput(['autocomplete' => 'off']); ?> <?php echo $form->field($model, 'email')->input('email'); ?> <?php echo $form->field($model, 'real_name'); ?> <?php echo $form->field($model, 'gender')->dropDownList(Admin::getGenderList());
public function actionItems($id) { $list = Store::getKeyValuePairs($id); $output = ['status' => 'ok', 'html' => '']; foreach ($list as $key => $value) { $output['html'] .= '<option value="' . $key . '">' . $value . '</option>'; } Yii::$app->response->format = Response::FORMAT_JSON; return $output; }