$form = ActiveForm::begin(['id' => 'form-lookups', 'action' => ['index'], 'method' => 'get']); ?> <div class="entry"> <?php echo $form->field($model, 'label'); ?> <?php echo $form->field($model, 'description'); ?> </div> <div class="entry"> <?php echo $form->field($model, 'return_type')->dropDownList(Lookup::returnTypeOptions(), ['prompt' => '']); ?> <?php echo $form->field($model, 'enabled')->dropDownList(Option::booleanOptions(), ['prompt' => '']); ?> </div> <div class="form-group buttons"> <?php echo Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']); ?> <?php echo Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']); ?> </div>
/** * 返回类型 * @param integer $value * @return mixed */ public function asLookupReturnType($value) { if ($value === null) { return $this->nullDisplay; } $options = Lookup::returnTypeOptions(); return isset($options[$value]) ? $options[$value] : $this->nullDisplay; }
<div class="box-body"> <?php echo $form->field($model, 'label')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'value')->textarea(); ?> <?php echo $form->field($model, 'return_type')->dropDownList(Lookup::returnTypeOptions()); ?> <?php echo $form->field($model, 'enabled')->checkbox(); ?> </div> <div class="box-footer"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => 'btn btn-info pull-right']); ?> </div> <?php