Carsten Brandt 11 years ago
parent
commit
2b9b364c5b
  1. 16
      docs/guide/form.md

16
docs/guide/form.md

@ -88,3 +88,19 @@ customize the output, you can chain additional methods to this call:
<?= $form->field($model, 'username')->textInput()->hint('Please enter your name')->label('Name') ?>
```
This will create all the `<label>`, `<input>` and other tags according to the template defined by the form field.
To add these tags yourself you can use the `Html` helper class. The following is equivalent to the code above:
```php
<?= Html::activeLabel($model, 'password'); ?>
<?= Html::activePasswordInput($model, 'password'); ?>
<?= Html::error($model, 'password'); ?>
or
<?= Html::activeLabel($model, 'username', ['label' => 'name']); ?>
<?= Html::activeTextInput($model, 'username'); ?>
<?= Html::error($model, 'username'); ?>
<div class="hint-block">Please enter your name</div>
```

Loading…
Cancel
Save