熊本污 2016-05-03 20:01:39 5814次浏览 4条评论 10 2 0
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View *//* @var $form yii\widgets\ActiveForm *//* @var $model app\models\LoginForm */

$this->title = 'Login';
?>
<h1><?= Html::encode($this->title) ?></h1> //获取动态标题

<p>Please fill out the following fields to login:</p>

<?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'username') ?>  //文本框
    <?= $form->field($model, 'password')->passwordInput() ?> //密码框
   
    <?= Html::submitButton('Login') ?>  //提交按钮

<?php ActiveForm::end();?> 




文本框:textInput();
密码框:passwordInput();
单选框:radio(),radioList();
复选框:checkbox(),checkboxList();
下拉框:dropDownList();
隐藏域:hiddenInput();
文本域:textarea(['rows'=>3]);
文件上传:fileInput();
提交按钮:submitButton();
重置按钮:resetButtun(); 

<?php

'action'=>Url::to(['user/admin']),
$form = ActiveForm::begin(['action' => ['test/getpost'],'method'=>'post',]); ?>
 
<? echo $form->field($model, 'username')->textInput(['maxlength' => 20,'value'=>1]) ?>
<?= $form->field($model, 'end_at',['inputOptions'=>['placeholder'=>"输入结束日期","onclick"=>"laydate()"]])->textInput(["style"=>" width:300px; height:35px;"])->lable(false) ?>   //lable(false)没有标签  lable(true) 标签为1 
标签与提示  
<?= $form->field($model, 'username')->textInput()->hint('请输入你的用户名')->label('用户名') ?>  

<? 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() ?>
<?= $form->field($model, 'username')->fileInput(['multiple'=>'multiple']) ?>  

<? 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(); ?>

 http://www.poluoluo.com/jzxy/201601/450983.html

觉得很赞
您需要登录后才可以评论。登录 | 立即注册