Activeform
文本框:textInput();
密码框:passwordInput();
单选框:radio(),radioList();
复选框:checkbox(),checkboxList();
下拉框:dropDownList();
隐藏域:hiddenInput();
文本域:textarea(['rows'=>3]);
文件上传:fileInput();
提交按钮:submitButton();
重置按钮:resetButtun();
<?php
$form = ActiveForm::begin([
'action' => ['test/getpost'],
'method'=>'post',
]);
?>
<? echo $form->field($model, 'username')->textInput(['maxlength' => 20]) ?>
<? echo $form->field($model, 'password')->passwordInput(['maxlength' => 20]) ?>
<? echo $form->field($model, 'sex')->radioList(['1'=>'男','0'=>'女']) ?>
<? echo $form->field($model, 'edu')->dropDownList(['1'=>'大学','2'=>'高中','3'=>'初中'],
['prompt'=>'请选择','style'=>'width:120px']) ?>
<? echo $form->field($model, 'file')->fileInput() ?>
<? echo $form->field($model, 'hobby')->checkboxList(['0'=>'篮球','1'=>'足球','2'=>'羽毛球','3'=>'乒乓球']) ?>
<? echo $form->field($model, 'info')->textarea(['rows'=>3]) ?>
<? echo $form->field($model, 'userid')->hiddenInput(['value'=>3]) ?>
<? echo Html::submitButton('提交', ['class'=>'btn btn-primary','name' =>'submit-button']) ?>
<? echo Html::resetButton('重置', ['class'=>'btn btn-primary','name' =>'submit-button']) ?>
<?php ActiveForm::end(); ?>
YII2.0 Activeform表单组件的使用方法
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:获取手机的gps定位
下一篇:LeetCode-两数之和
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
谷歌地图数据采集软件使用方法
专为做外贸的朋友开发的一款基于谷歌地图数据采集的软件,可以采集任意国家、任意地区的公司地址、电话号码、邮件地址等数据。
谷歌地图 谷歌地图数据采集软件 谷歌地图数据采集 谷歌地图数据采集器 -
Yii2.0中的PSR规范
什么是PSR?PSR是PHP Standards Recommendation的简称,这个是php-fig组
php 开发语言 PHP 命名空间