ajax-edit.php 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. use yii\widgets\ActiveForm;
  3. use common\helpers\Url;
  4. use common\helpers\ArrayHelper;
  5. $form = ActiveForm::begin([
  6. 'id' => $model->formName(),
  7. 'enableAjaxValidation' => true,
  8. 'validationUrl' => Url::to(['ajax-edit', 'id' => $model['id'], 'type' => $model['upload_type']]),
  9. 'fieldConfig' => [
  10. 'template' => "<div class='row'><div class='col-sm-2 text-right'>{label}</div><div class='col-sm-10'>{input}\n{hint}\n{error}</div></div>",
  11. ]
  12. ]);
  13. ?>
  14. <div class="modal-header">
  15. <h4 class="modal-title">编辑资源</h4>
  16. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  17. </div>
  18. <div class="modal-body">
  19. <?= $form->field($model, 'name')->textInput(); ?>
  20. <?= $form->field($model, 'cate_id')->dropDownList(ArrayHelper::merge([0 => '请选择'], $cateMap)); ?>
  21. </div>
  22. <div class="modal-footer">
  23. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  24. <button class="btn btn-primary" type="submit">保存</button>
  25. </div>
  26. <?php ActiveForm::end(); ?>
粤ICP备19079148号