Commit 0d03f720 by Carsten Brandt

added usage example of ActiveField::widget()

parent d825b745
...@@ -641,6 +641,15 @@ class ActiveField extends Component ...@@ -641,6 +641,15 @@ class ActiveField extends Component
* If you want to use a widget that does not have `model` and `attribute` properties, * If you want to use a widget that does not have `model` and `attribute` properties,
* please use [[render()]] instead. * please use [[render()]] instead.
* *
* For example to use the [[MaskedInput]] widget to get some date input, you can use
* the following code, assuming that `$form` is your [[ActiveForm]] instance:
*
* ```php
* $form->field($model, 'date')->widget(\yii\widgets\MaskedInput::className(), [
* 'mask' => '99/99/9999',
* ]);
* ```
*
* @param string $class the widget class name * @param string $class the widget class name
* @param array $config name-value pairs that will be used to initialize the widget * @param array $config name-value pairs that will be used to initialize the widget
* @return static the field object itself * @return static the field object itself
......
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