Example of YII2.0 Activeform component usage, yii2.0activeform. Example of how to use the Activeform component of YII2.0, yii2.0activeform this article describes how to use the Activeform component of YII2.0. For your reference, see the following example: Activef YII2.0 Activeform component usage, yii2.0activeform
This article describes how to use the Activeform component of YII2.0. We will share this with you for your reference. The details are as follows:
Activeform
Text box: textInput ();
Password box: passwordInput ();
Single region: radio (), radioList ();
Check box: checkbox (), checkboxList ();
Drop-down box: dropDownList ();
Hidden Field: hiddenInput ();
Text field: textarea (['rows '=> 3]);
File upload: fileInput ();
Submit button: submitButton ();
Reset Button: 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' => 'male', '0' => 'female])?> <? Echo $ form-> field ($ model, 'edu')-> dropDownList (['1' => '', '2' => 'High School ', '3' => 'Junior High School'], ['propt' => 'Select ', 'Style' => 'width: 120px'])?> <? Echo $ form-> field ($ model, 'file')-> fileInput ()?> <? Echo $ form-> field ($ model, 'hobby')-> checkboxList (['0' => 'Basketball ', '1' => 'soccer ', '2' => 'Badminton ', '3' => 'table tennis'])?> <? Echo $ form-> field ($ model, 'info')-> textarea (['rows '=> 3])?> <? Echo $ form-> field ($ model, 'userid')-> hiddenInput (['value' => 3])?> <? Echo Html: submitButton ('submit', ['class' => 'btn btn-primary ', 'name' => 'Submit-click'])?> <? Echo Html: resetButton ('reset ', ['class' => 'btn btn-primary', 'name' => 'Submit-click'])?> <? Php ActiveForm: end ();?>
I hope this article will help you design PHP programs based on the Yii Framework.
Articles you may be interested in:
- Yii2 uses the Bootbox plug-in to implement custom pop-up windows
- YII2 framework (IV) extension plug-in yii2-kartikgii from scratch
- YII2 framework (III) extension plug-in yii2-gird from scratch
- YII2 framework from scratch (2) Install extension plug-ins through Composer
- Use the drop-down menu to automatically search for yii-widget-select2 instance analysis in the yii2 framework
- Method for using the Active Record mode in yii2
- How to add a verification code in yii2
- Method for referencing the date plug-in yii2-date-picker in bootstrap in the Yii2 framework
Examples this article describes how to use the Activeform form component of YII2.0. Share it with you for your reference. The details are as follows: Activef...