The model attribute value will be used to create the redio button.įield($model, 'gender')->radio(array('label'=>'')) ?>įield($model, 'gender')->radio(array('label'=>'')) 'labelOptions'=>array('style'=>'padding:5px '),ĬheckboxList() function is used to display the check box list using array of input argument values.
We added the following options like custom label, disabled, style etcįield($model, 'population')->checkbox() ?>įield($model, 'population')->checkbox(array('label'=>'')) ?>įield($model, 'population')->checkbox(array('label'=>''))įield($model, 'population')->checkbox(array( Using below we can create the Checkbox base on model attribute of yii2.0 framework.
YII FILE UPLOAD EXAMPLE PASSWORD
We added different type of password input field like password with hint, custom lable.įield($model, 'email')->input('email') ?>įileInput() function is used to create a file input fields and 'multiple' parameter is used to upload multiple file in single upload.įield($model, 'uploadFile')->fileInput() ?> >hint('Password should be within A-Za-z0-9') The model attribute value will be used as the content in the textarea.įield($model, 'desc')->textarea(array('rows'=>2,'cols'=>5)) ?>įield($model, 'password')->input('password') ?>įield($model, 'password')->passwordInput() ?>įield($model, 'password')->passwordInput() Format 2 is a text input field with hint, label. Here we added active form with basic details like form id, class and enctype for file uploads.įormat 1 is a normal text input field. 'ActiveForm' namespace is very important to create the a active form and 'Html' namespace is very useful to display the different html input fields. 'yii\widgets\ActiveForm' class is used to create a form and 'yii\helpers\Html' class is used to display the different type of HTML input fields like buttons, textbox, select box etc.ĪctiveForm::begin() - creates a form instance and beginning of the form.ĪctiveForm::begin() and ActiveForm::end() - All of the content placed between this.