1.引入组件
u yii\widgets\ActiveForm;
2.创建组件
<?php/** * Created by PhpStorm. * Ur: Hansn cz P03 * Date: 17/11/17 * Time: 9:56 */u yii\helpers\Url;u yii\widgets\ActiveForm;u common\components\Leohowl;u backend\components\FilePicker\FilePicker;u backend\components\AddChip\AddChipWidget;$model['uuid'] = ist($model['uuid']) ? $model['uuid'] : Leohowl::createRandomString(6);$model['type'] = ist($model['type']) ? $model['type'] : 'HTFC(DT)-I';$model['status'] = ist($model['status']) ? $model['status'] : 1;$model['orders'] = ist($model['orders']) ? $model['orders'] : 100;if($type === 'add'){ $template = ['action' => '添加','url' => Url::toRoute(['/fan/add'])];} el { $template = ['action' => '更新','url' => Url::toRoute(['/fan/edit', 'uuid'=>$model['uuid']])];}$this->title = "风机管理";$this->params['breadcrumbs'][] = ['label'=>'风机管理'];$this->params['breadcrumbs'][] = ['label'=>'风机列表', 'url'=>Url::toRoute(['/fan/list'])];$this->params['breadcrumbs'][] = ['label'=>$template['action'].'风机详情'];$this->params['page_title'] = $template['action'].'风机详情';$this->registerJsFile(DIST.'/script/ueditor/ueditor.config.js', ['depends' => backend\asts\AppAst::className(), "position"=> $this::POS_END]);$this->registerJsFile(DIST.'/script/ueditor/ueditor.all.js', ['depends' => backend\asts\AppAst::className(), "position"=> $this::POS_END]);?><div class="box box-solid"><div class="box-body"><?php$form = ActiveForm::begin(['id'=>'cms-fan','action'=>$template['url'],'method'=>'post','fieldConfig'=>['template'=>'<div class="form-group input-group"><div class="col-lg-3">{label}</div><div class="col-lg-7">{input}</div></div>','inputOptions' => ['class' => 'form-control'],],])?><div class="col-lg-12"><?=$form->field($model, 'uuid',['template'=>'{input}'])->textInput(['maxlength' => 16,'type'=>'text'])->hiddenInput()->label(fal)?><?=$form->field($model, 'type')->textInput(['maxlength' => 128,'type'=>'text'])->label('<span class="required">*</span>风机型号',['class'=>济南小吃加盟'input-group-addon'])?><?=$form->field($model, 'num')->textInput(['type'=>'text'])->label('<span class="required">*</span>型号数',['class'=>'input-group-addon'])?><?=$form->field($model, 'volume')->textInput(['type'=>'text'])->label('<span class="required">*</span>风量',['class'=>'input-group-addon'])?><?=$form->field($model, 'pa')->textInput(['type'=>'text'])->label('<span class="required">*</span>全压',['class'=R0是什么意思可复制的万能空白昵称>'input-group-addon'])?><?=$form->field($model, 'power')->textInput(['type'=>'text'])->label('<span class="required">*</span>功率',['class'=>'input-group-addon'])?><?=$form->field($model, 'orders')->textInput(['maxlength' => 5,'type'=>'text'])->label('<span class="required">*</span>排序',['class'=>'input-group-addon'])?><?=$form->field($model, 'status')->radioList(['1'=>'在线', '0'=>'离线'])->label('<span class="required">*</span>状态')?><?= $form->field($model, 'rememberMe')->checkbox(['template' => "<div class=\"col-lg-offt-1 col-lg-3\">{input} {l越狱重启abel}</div>\n<div class=\"col-lg-8\">{error}</div>",]) ?></div><div class="col-lg-12 submit"><div class="col-lg-3"></div><div class="col-lg-8"><button type="submit" class="btn btn-success push-action"><?=$template['action']?></button></div></div>//<?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?><?php ActiveForm::end();?></div></div><小学一年级试卷分析!--<script>--><?php $this->beginBlock('script') ?><?php $this->endBlock() ?><?php $this->registerJs($this->blocks['script'], \yii\web\View::POS_END); ?>
本文地址:https://blog.csdn.net/weixin_44432032/article/details/111058969
本文发布于:2023-04-09 00:46:03,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/75294872e2e18b95d69afc2de5dd87bc.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:yii中form组件的创建.doc
本文 PDF 下载地址:yii中form组件的创建.pdf
留言与评论(共有 0 条评论) |