Example of Activeform form component usage in YII2.0, yii2.0activeform _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.