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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version
Useful JavaScript development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft





