Commit c144d8b7 by Carsten Brandt

added docs about array attributes to the guide

fixes #3302
parent 6bad2436
...@@ -3,7 +3,9 @@ Bootstrap Widgets ...@@ -3,7 +3,9 @@ Bootstrap Widgets
> Note: This chapter is under development. > Note: This chapter is under development.
Out of the box, Yii includes support for the [Bootstrap 3](http://getbootstrap.com/) markup and components framework (also known as "Twitter Bootstrap"). Bootstrap is an excellent, responsive framework that can greatly speed up the client-side of your development process. Out of the box, Yii includes support for the [Bootstrap 3](http://getbootstrap.com/) markup and components framework
(also known as "Twitter Bootstrap"). Bootstrap is an excellent, responsive framework that can greatly speed up the
client-side of your development process.
The core of Bootstrap is represented by two parts: The core of Bootstrap is represented by two parts:
......
...@@ -59,7 +59,7 @@ class LoginForm extends Model ...@@ -59,7 +59,7 @@ class LoginForm extends Model
} }
``` ```
The controller will pass an instance of that model to the view, wherein the Active Form widget is used: The controller will pass an instance of that model to the view, wherein the [[yii\widgets\ActiveForm|ActiveForm]] widget is used:
```php ```php
use yii\helpers\Html; use yii\helpers\Html;
...@@ -108,6 +108,18 @@ If you want to use one of HTML5 fields you may specify input type directly like ...@@ -108,6 +108,18 @@ If you want to use one of HTML5 fields you may specify input type directly like
<?= $form->field($model, 'email')->input('email') ?> <?= $form->field($model, 'email')->input('email') ?>
``` ```
Specifying attribute of the model can be does in more sophisticated ways for example when an attribute may
take an array value when uploading multiple files or selecting multiple items you may specify it by appending `[]`
to the attribute name:
```php
// allow multiple files to be uploaded:
echo $form->field($model, 'uploadFile[]')->fileInput('multiple'=>'multiple');
// allow multiple items to be checked:
echo $form->field($model, 'items[]')->checkboxList(['a' => 'Item A', 'b' => 'Item B', 'c' => 'Item C']);
```
> **Tip**: in order to style required fields with asterisk you can use the following CSS: > **Tip**: in order to style required fields with asterisk you can use the following CSS:
> >
```css ```css
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment