Example of how to use the Activeform component of YII20

Source: Internet
Author: User
: This article describes how to use the Activeform component of YII20. For more information about PHP tutorials, see. 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.

The above describes how to use the form component of the YII20 Activeform, including some content, and hope to help friends who are interested in the PHP Tutorial.

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.