ActiveForm Example
The following example covers almost all uses of ActiveForm. There are renderings below the corresponding code. As for how to modify the structure of the form to achieve what we need, please see the related tutorials above
<?php use yiiootstrapActiveForm; use yiihelpersHtml; $this->title = '编程学习'; ?> <div class="row"> <div class="col-lg-9"> <?php $form = ActiveForm::begin(['id' => 'form-signup']); ?> <?= $form->field($model, 'test1')->label('测试Label') ?> <?= $form->field($model, 'test2')->hint('测试hint')->label('测试提示'); ?> <!-- input(type) type即为input类型 text password等--> <?= $form->field($model, 'test3')->input('text')->label('测试input') ?> <?= $form->field($model, 'test3')->textInput()->label('测试文本框') ?> <?= $form->field($model, 'test3')->hiddenInput()->label('测试隐藏框') ?> <?= $form->field($model, 'test3')->passwordInput()->label('测试密码框') ?> <?= $form->field($model, 'test3')->textarea()->label('测试文本域') ?> <?= $form->field($model, 'test3')->fileInput()->label('测试文件上传') ?> <?= $form->field($model, 'test3')->radio()->label('测试radio') ?> <?= $form->field($model, 'test3')->checkbox()->label('测试checkbox') ?> <?= $form->field($model, 'test3')->listBox(['0'=>'box1','1'=>'box2'])->label('测试listBox') ?> <?= $form->field($model, 'test3')->checkboxList(['0'=>'box1','1'=>'box2'])->label('测试checkboxList') ?> <?= $form->field($model, 'test3')->radioList(['0'=>'radio1','1'=>'radio2'])->label('测试radioList') ?> <?= $form->field($model, 'test3')->dropDownList(['0'=>'下拉1','1'=>'下拉2']) ?> <?= $form->field($model,'test3')->widget(yiicaptchaCaptcha::className())->label('测试widget')?> <div class="form-group"> <?= Html::submitButton('按钮', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?> </div> <?php ActiveForm::end(); ?> </div> </div>
The above is the detailed explanation of Yii2.0 ActiveForm usage. For more related content, please pay attention to the PHP Chinese website (www.php .cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools