Builder Details Form Builder   Tips

Latest Stable Version Latest Unstable Version Total Downloads Monthly Downloads Daily Downloads
Thankful to Krajee!
to get more out of us.

NOTE: This extension depends on the kartik-v/yii2-krajee-base extension which in turn depends on the yiisoft/yii2-bootstrap extension. Check the composer.json for this extension's requirements and dependencies that may be updated by composer.

The Form Builder widget allows you to build a form dynamically through a configuration array. The widget provides these features:

  • Configure your form fields from a model extending yii\base\model or yii\db\ActiveRecord.
  • Ability to support various Bootstrap 3.x form layouts. Uses the advanced kartik\widgets\ActiveForm.
  • Use Bootstrap column/builder layout styling by just supplying columns property.
  • Build complex layouts (for example single, double, or multi columns in the same layout) - by reusing the widget for building your attributes.
  • Tweak ActiveForm defaults to control field options, styles, templates, and layouts.
  • Configure your own hints to display below each active field attribute.
  • Various Bootstrap 3.x styling features are available by default. However, one can easily customize and theme it to one's liking using any CSS framework.
  • Supports and renders HTML input types (uses kartik\widgets\ActiveField) including input widgets.

The Form Builder widget accepts these following settings:
  1. model Model, or ActiveRecord, model instance extending from yii\base\Model or yii\db\ActiveRecord. One of form and model OR formName is mandatory.

  2. form ActiveForm, the ActiveForm instance extending from kartik\form\ActiveForm or kartik\widgets\ActiveForm. You normally would call it as $form = \kartik\widgets\ActiveForm::begin();. One of form and model OR formName is mandatory.

  3. formName string, the form name to be provided if not using with model and ActiveForm. One of form and model OR formName is mandatory.

  4. contentBefore string, any additional content to be displayed before the rendered form fieldset. This is not HTML encoded.

  5. contentAfter string, any additional content to be displayed after the rendered form fieldset. This is not HTML encoded.

  6. attributes array, the most important part of your form builder configuration. This is mandatory. The attributes array needs to be setup as $attribute => $setting, where:

    • $attribute string, the attribute name from the model. You can define your own custom (non-model) attribute by assigning $setting['type'] to Form::INPUT_RAW.

    • $setting array, the attribute settings which allows you to setup the following properties:

      • type string, the input type for the attribute. Allows you to configure most inputs, widgets, and raw text. Should be one of the values below:

        • Form::INPUT_TEXT or textInput

        • Form::INPUT_TEXTAREA or textarea

        • Form::INPUT_PASSWORD or passwordInput

        • Form::INPUT_DROPDOWN_LIST or dropdownList

        • Form::INPUT_LIST_BOX or listBox

        • Form::INPUT_CHECKBOX or checkbox

        • Form::INPUT_RADIO or radio

        • Form::INPUT_CHECKBOX_LIST or checkboxList

        • Form::INPUT_RADIO_LIST or radioList

        • Form::INPUT_MULTISELECT or multiselect

        • Form::INPUT_FILE or fileInput

        • Form::INPUT_HTML5 or input

        • Form::INPUT_WIDGET or widget

        • Form::INPUT_STATIC or staticInput * useful for showing a display-only field

        • Form::INPUT_HIDDEN or hiddenInput * useful for rendering hidden input

        • Form::INPUT_HIDDEN_STATIC or hiddenStaticInput * combines a display-only field very similar to INPUT_STATIC along with a HIDDEN input.

        • Form::INPUT_RAW or raw * useful to set your own free text, HTML markup,or use a Closure function to return value

      • visible boolean, whether the attribute is visible. One can use this property to control visibility of attributes conditionally.

      • attributes array, the nested group of sub attributes that will be grouped together. This configuration will be similar to `attributes`. The label property will be auto set to `false` for each sub attribute.

      • value string | Closure, the value to be displayed if the type is set to Form::INPUT_RAW. This will display the raw text from value field if it is a string. If this is a Closure, your anonymous function call should be of the type: function ($model, $index, $widget) { }, where $model is the current model, $index is the zero based index of the attribute array list, and $widget is the current widget instance.

      • staticValue string | Closure, the value to be displayed if the type is set to Form::INPUT_STATIC. If not set, the value will be automatically generated from the value setting above OR from the value of the model attribute. If this is setup as a Closure, your anonymous function call should be of the type: function ($model, $index, $widget) { }, where $model is the current model, $index is the zero based index of the attribute array list, and $widget is the current widget instance.

      • hiddenStaticOptions array, applicable only for Form::INPUT_HIDDEN_STATIC type. This will allow you to setup HTML attributes for the static control container. For Form::INPUT_HIDDEN_STATIC type, the options setting will represent the HTML attributes for the hidden input.

      • label string | boolean, the custom attribute label. If this is not set, the model attribute label will be automatically used. If you set it to false, it will not be displayed.

      • labelSpan int, the grid span width of the label container, which is especially useful for horizontal forms. If not set this will be derived automatically from the formConfig['labelSpan'] property of $form (ActiveForm).

      • labelOptions array, the HTML attributes for the label. Will be applied only when NOT using with active form and only if label is set.

      • prepend string, any markup to prepend before the input. For ActiveForm fields, this content will be prepended before the field group (including label, input, error, hint blocks).

      • append string, any markup to append before the input. For ActiveForm fields, this content will be appended after the field group (including label, input, error, hint blocks).

      • container array, HTML attributes for the div container to wrap the input. For ActiveForm, this will envelop the field group (including label, input, error, hint blocks). If not set or empty, no container will be wrapped.

      • inputContainer array, HTML attributes for the div container to wrap the input control only. If not set or empty, no container will be wrapped. Will be applied only when NOT using with ActiveForm.

      • fieldConfig array, the additional configuration for the ActiveField. Will use the kartik\form\ActiveField or \kartik\widgets\ActiveField configuration parameters.

      • hint string, the hint text to be shown below the active field.

      • items array, the list of items if input type is one of the following:

        • Form::INPUT_DROPDOWN_LIST or dropdownList

        • Form::INPUT_LIST_BOX or listBox

        • Form::INPUT_CHECKBOX_LIST or checkboxList

        • Form::INPUT_RADIO_LIST or radioList

        • Form::INPUT_MULTISELECT or multiselect

      • enclosedByLabel boolean, whether the input is to be enclosed by label. Applicable only for Form::INPUT_CHECKBOX or Form::INPUT_RADIO. Defaults to true.

      • html5type string, the type of HTML5 input, if input type is set to Form::INPUT_HTML5.

      • widgetClass string, the classname if input type is Form::INPUT_WIDGET.

      • options array, the additional HTML attributes to be applied to the input. These will take in the widget configuration settings if type is set to Form::INPUT_WIDGET.

      • columnOptions array, override columnOptions setup at Form widget level. This setting makes sense only if columns setting is greater than 1.

  7. attributeDefaults array, the default settings that will be applied for all attributes. The array will be configured similar to a single attribute setting value in the $attributes array. One will typically default markup and styling like type, container, prepend, append etc. For example:

    // settings for horizontal form used without active form
    'attributeDefaults' => [
        'type' => Form::INPUT_TEXT,
        'labelOptions' => ['class'=>'col-md-2'],
        'inputContainer' => ['class'=>'col-md-10'],
    ]
    

    Note: The settings at the $attributes level will override these default settings.

  8. staticOnly bool, whether the entire form is to be converted to static only (read only) inputs irrespective of the attribute configuration. Defaults to false.

  9. columns integer, the number of columns in which to split the fields horizontally. If not set, defaults to 1 column. This will be auto generated based on number of attributes if autoGenerateColumns is set to true.

  10. autoGenerateColumns boolean, whether to auto calculate and generate the columns based on the count of attributes for each row. If not set, Defaults to false. If the count of attributes is > FormGrid::$gridSize then no further columns will be generated.

  11. columnSize string, the bootstrap device size for rendering each Bootstrap grid column. Applicable Defaults to `Form::SIZE_SMALL`. Can take in one of these options:

    • Form::SIZE_LARGE or lg

    • Form::SIZE_MEDIUM or md

    • Form::SIZE_SMALL or sm

    • Form::SIZE_TINY or xs

  12. columnOptions array, the HTML attributes for the grid columns. Applicable only if columns is greater than 1. The following special options are recognized:

    • colspan integer, the customized grid column span to use if you need assymmetric field columns in your layout. For the default bootstrap grid this is a number between 1 to 12.

  13. rowOptions array, the HTML attributes for the grid rows. Applicable only if columns is greater than 1.

  14. options array, the HTML attributes for the field/attributes container. The following options are additionally recognized:

    • tag: string, the HTML tag for the container. Defaults to fieldset.

  15. gridSize integer, the bootstrap grid size (maximum number of columns) based on which the bootstrap grid columns will be generated. Defaults to 12.

The Form Builder widget allows you to access the following events for advanced configuration. The extension includes an kartik\builder\ActiveFormEvent class which extends from yii\base\Event and is used to trigger events within the kartik\builder\Form widget. The ActiveFormEvent allows access to the following parameters:

  • $attribute: string, the attribute being processed

  • $index: string, the zero based index of the attribute in the configuration array

  • $eventData: array, the data passed as key value pairs to the event.

The Form widget triggers the following events:

  • Form::EVENT_BEFORE_PARSE_INPUT or 'eBeforeParseInput': Triggered before parsing the input for each attribute. The $eventData passed includes the attribute settings array for read and write.

  • Form::EVENT_AFTER_PARSE_INPUT or 'eAfterParseInput': Triggered after parsing the input for each attribute. The $eventData passed includes the rendered attribute input content string for read and write.

  • Form::EVENT_BEFORE_RENDER_SUB_ATTR or 'eBeforeRenderSubAttr': Triggered before parsing the input and if the attribute has sub attributes defined under it. The $eventData passed includes the attribute settings array for read and write.

  • Form::EVENT_AFTER_RENDER_SUB_ATTR or 'eAfterRenderSubAttr': Triggered before parsing the input and if the attribute has sub attributes defined under it. The $eventData passed includes the rendered attribute input content string for read and write.

Some scenarios of using the Form Builder are mentioned below:

Step 1: Setting up model method

Setup your attributes array for the form builder. For example you could create a globally accessible method in your model (or any accessible class).

public function getFormAttribs() {
    return [
        'username'=>['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter username...']],
        'password'=>['type'=>Form::INPUT_PASSWORD, 'options'=>['placeholder'=>'Enter password...']],
        'rememberMe'=>['type'=>Form::INPUT_CHECKBOX],
        'actions'=>['type'=>Form::INPUT_RAW, 'value'=>Html::submitButton('Submit', ['class'=>'btn btn-primary'])];
    ];
}   

Step 2: Rendering the form (view)

Create a form instance using \kartik\widgets\ActiveForm and pass it to the FormBuilder widget along with the model instance. Let's say you want to display a Bootstrap INLINE Layout for your form

use kartik\widgets\ActiveForm;
use kartik\builder\Form;
$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_INLINE]);
echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'attributes'=>$model->formAttribs
]);
ActiveForm::end();
Scenario 1 Output

Pass the columns property to setup the number of Bootstrap grid columns into which the attributes will be divided. For example, if instead of 1 column, we want the fields to be split into 2 columns for Scenario 1, you set columns to 2. This would autocalculate the number of rows needed. You would for the Scenario 1 example get 2 rows of fields. The first row will contain the username and password. The second row will contain one column rememberMe.

use kartik\widgets\ActiveForm;
use kartik\builder\Form;
$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_VERTICAL]);
echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>$model->formAttribs
]);
echo Html::button('Submit', ['type'=>'button', 'class'=>'btn btn-primary']);
ActiveForm::end();
Scenario 2 Output

You may practically need a complex layout, which can have single, double or multi columns within the same form. You may also be planning to use various input types for your design and place as you want on your layouts. In order to achieve these, you can call the Form::widget multiple times with different settings as described below.

Note

This example contains usage of various input types, including the INPUT_RAW example at the end. Note you can use INPUT_RAW type to define your own custom attributes. It also shows an example of how you can add hints to your active field attributes.
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_VERTICAL]);
echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[       // 2 column layout
        'username'=>['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter username...']],
        'password'=>['type'=>Form::INPUT_PASSWORD, 'options'=>['placeholder'=>'Enter password...']]
    ]
]);
echo Form::widget([       // 1 column layout
    'model'=>$model,
    'form'=>$form,
    'columns'=>1,
    'attributes'=>[
        'notes'=>['type'=>Form::INPUT_TEXTAREA, 'options'=>['placeholder'=>'Enter notes...']],
    ]
]);
echo Form::widget([     // nesting attributes together (without labels for children)
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[
        'date_range' => [
            'label' => 'Date Range',
            'attributes'=>[
                'begin_date' => [
                    'type'=>Form::INPUT_WIDGET, 
                    'widgetClass'=>'\kartik\datecontrol\DateControl',
                    'options'=>[
                        'options'=>[
                            'options'=>['placeholder'=>'Date from...']
                        ]
                    ],
                ],
                'end_date'=>[
                    'type'=>Form::INPUT_WIDGET, 
                    'widgetClass'=>'\kartik\datecontrol\DateControl', 
                    'options'=>[
                        'options'=>[
                            'options'=>['placeholder'=>'Date to...', 'class'=>'col-md-9']
                        ]
                    ]
                ],
            ]
        ],
        'time_range'=>[
            'label' => 'Time Range',
            'attributes'=>[
                'begin_time'=>[
                    'type'=>Form::INPUT_WIDGET, 
                    'widgetClass'=>'\kartik\widgets\TimePicker', 
                    'options'=>['options'=>['placeholder'=>'Time from...']],
                ],
                'end_time'=>[
                    'type'=>Form::INPUT_WIDGET, 
                    'widgetClass'=>'\kartik\widgets\TimePicker', 
                    'options'=>['options'=>['placeholder'=>'Time to...', 'class'=>'col-md-9']]
                ],
            ]
        ],
    ]
]);
echo Form::widget([       // 3 column layout
    'model'=>$model,
    'form'=>$form,
    'columns'=>3,
    'attributes'=>[
        'birthday'=>[
            'type'=>Form::INPUT_WIDGET, 
            'widgetClass'=>'\kartik\widgets\DatePicker', 
            'hint'=>'Enter birthday (mm/dd/yyyy)'
        ],
        'state_1'=>[
            'type'=>Form::INPUT_WIDGET, 
            'widgetClass'=>'\kartik\widgets\Select2', 
            'options'=>['data'=>$model->typeahead_data], 
            'hint'=>'Type and select state'
        ],
        'color'=>[
            'type'=>Form::INPUT_WIDGET, 
            'widgetClass'=>'\kartik\widgets\ColorInput', 
            'hint'=>'Choose your color'
        ],
        'status'=>[
            'type'=>Form::INPUT_RADIO_LIST, 
            'items'=>[true=>'Active', false=>'Inactive'], 
            'options'=>['inline'=>true]
        ],
        'brightness'=>[
            'type'=>Form::INPUT_WIDGET, 
            'label'=>Html::label('Brightness (%)'), 
            'widgetClass'=>'\kartik\widgets\RangeInput', 
            'options'=>['width'=>'80%']
        ],
        'actions'=>[
            'type'=>Form::INPUT_RAW, 
            'value'=>'<div style="text-align: right; margin-top: 20px">' . 
                Html::resetButton('Reset', ['class'=>'btn btn-default']) . ' ' .
                Html::button('Submit', ['type'=>'button', 'class'=>'btn btn-primary']) . 
                '</div>'
        ],
    ]
]);
ActiveForm::end();
Scenario 3 Output
Enter birthday (mm/dd/yyyy)
 
Type and select state
Choose your color

Extending scenario 3, this scenario depicts a bootstrap horizontal form layout with nesting of attributes to be collated together without labels. It also includes customized labels and editing of the label span and column span widths.

use kartik\widgets\ActiveForm;
use kartik\builder\Form;
$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_HORIZONTAL, 'formConfig'=>['labelSpan'=>4]]);
echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'columns'=>1,
    'attributes'=>[
        'address_detail' => [   // complex nesting of attributes along with labelSpan and colspan
            'label'=>'Address',
            'labelSpan'=>2,
            'columns'=>6,
            'attributes'=>[
                'address'=>[
                    'type'=>Form::INPUT_TEXT, 
                    'options'=>['placeholder'=>'Enter address...'],
                    'columnOptions'=>['colspan'=>3],
                ],
                'phone'=>[
                    'type'=>Form::INPUT_TEXT, 
                    'options'=>['placeholder'=>'Phone...'],
                    'columnOptions'=>['colspan'=>2],
                ],
                'zip_code'=>[
                    'type'=>Form::INPUT_TEXT, 
                    'options'=>['placeholder'=>'Zip...']
                ],
            ]
        ]
    ]
]);
echo Form::widget([ // fields with labels
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[
        'state_1'=>['label'=>'Province 1', 'options'=>['placeholder'=>'Province 1...']],
        'state_1a'=>['label'=>'Province 2', 'options'=>['placeholder'=>'Province 2...']],
    ]
]);
echo Form::widget([ // continuation fields to row above without labels
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[
        'state_2'=>['label'=>'', 'options'=>['placeholder'=>'Province 1 Description...']],
        'state_3'=>['label'=>'', 'options'=>['placeholder'=>'Province 2 Description...']],
    ]
]);
echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[
        'status'=>['label'=>'Severity', 'items'=>[0=>'Low', 1=>'Medium', 2=>'High'], 'type'=>Form::INPUT_RADIO_BUTTON_GROUP],
        'status_1'=>['label'=>'Categories', 'items'=>[0=>'Group 1', 1=>'Group 2', 2=>'Group 3'], 'type'=>Form::INPUT_CHECKBOX_BUTTON_GROUP]
    ]
]);
echo Form::widget([ // hide label and extend input to full width
    'model'=>$model,
    'form'=>$form,
    'columns'=>1,
    'attributes'=>[
        'website'=>[
            'label'=>false, 
            'options'=>[
                'placeholder'=>'Enter website (this input fills the width when label is set to false)...'
            ]
        ],
    ]
]);
echo '<div class="text-right">' . Html::resetButton('Reset', ['class'=>'btn btn-default']) . '</div>';
ActiveForm::end();
Scenario 4 Output

Extending scenario 4, this scenario depicts a bootstrap horizontal form layout with entire form set to staticOnly/readonly.

use kartik\widgets\ActiveForm;
use kartik\builder\Form;
$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_HORIZONTAL, 'formConfig'=>['labelSpan'=>4]]);
echo Form::widget([
    'model'=>$model,
    'form'=>$form,
    'columns'=>1,
    'attributes'=>[
        'address_detail' => [   // complex nesting of attributes along with labelSpan and colspan
            'label'=>'Address',
            'labelSpan'=>2,
            'columns'=>6,
            'attributes'=>[
                'address'=>[
                    'type'=>Form::INPUT_HIDDEN_STATIC, 
                    'options'=>['placeholder'=>'Enter address...'],
                    'columnOptions'=>['colspan'=>3],
                ],
                'phone'=>[
                    'type'=>Form::INPUT_TEXT, 
                    'options'=>['placeholder'=>'Phone...'],
                    'columnOptions'=>['colspan'=>2],
                ],
                'zip_code'=>[
                    'type'=>Form::INPUT_TEXT, 
                    'options'=>['placeholder'=>'Zip...']
                ],
            ]
        ]
    ]
]);
echo Form::widget([ // fields with labels
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[
        'state_1'=>['label'=>'Province 1', 'options'=>['placeholder'=>'Province 1...']],
        'state_1a'=>['label'=>'Province 2', 'options'=>['placeholder'=>'Province 2...']],
    ]
]);
echo Form::widget([ // continuation fields to row above without labels
    'model'=>$model,
    'form'=>$form,
    'columns'=>2,
    'attributes'=>[
        'state_2'=>['label'=>'', 'options'=>['placeholder'=>'Province 1 Description...']],
        'state_3'=>['label'=>'', 'options'=>['placeholder'=>'Province 2 Description...']],
    ]
]);
echo Form::widget([ // hide label and extend input to full width
    'model'=>$model,
    'form'=>$form,
    'columns'=>1,
    'attributes'=>[
        'website'=>['label'=>false, 'options'=>['placeholder'=>'Enter website (this input fills the width when label is set to false)...']],
    ]
]);
echo '<div class="text-right">' . Html::resetButton('Reset', ['class'=>'btn btn-default']) . '</div>';
ActiveForm::end();
Scenario 5 Output
24th Street, Los Angeles
+1 821 2188822
21211
CA
AZ
California
Arizona
http://www.krajee.com

This scenario depicts a bootstrap horizontal form layout. It includes entirely skipping ActiveForm and using it as a normal form without a model.

use yii\helpers\Html;
use kartik\builder\Form;
echo Html::beginForm('', '', ['class'=>'form-horizontal']);
echo Form::widget([
    // formName is mandatory for non active forms
    // you can get all attributes in your controller 
    // using $_POST['kvform']
    'formName'=>'kvform',
    
    // default grid columns
    'columns'=>2,
    
    // set global attribute defaults
    'attributeDefaults'=>[
        'type'=>Form::INPUT_TEXT,
        'labelOptions'=>['class'=>'col-md-3'], 
        'inputContainer'=>['class'=>'col-md-9'], 
        'container'=>['class'=>'form-group'],
    ],
    
    'attributes'=>[
        'fld1'=>['label'=>'Name', 'value'=>'Kartik'],
        'fld2'=>['label'=>'Email', 'value'=>'info@solutions.com'],
        'fld3'=>['label'=>'From Date', 'type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\DatePicker'],
        'fld4'=>['label'=>'To Date', 'type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\DatePicker'],
        'fld5'=>['label'=>'Details', 'type'=>Form::INPUT_TEXTAREA],
        'fld6'=>['label'=>'Remarks', 'type'=>Form::INPUT_TEXTAREA],
        'fld7'=>[
            'label'=>'Severity', 
            'items'=>[0=>'Low', 1=>'Medium', 2=>'High'], 
            'type'=>Form::INPUT_RADIO_BUTTON_GROUP
        ],
        'fld8'=>[
            'label'=>'Categories', 
            'items'=>[0=>'Group 1', 1=>'Group 2', 2=>'Group 3'], 
            'type'=>Form::INPUT_CHECKBOX_BUTTON_GROUP
        ],
    ]
]);
echo Html::endForm();
Scenario 6 Output

Extension of scenario 6 to include static only forms for non model based scenarios. Also includes configuration of static values to override and define your own static values in static only mode.

use yii\helpers\Html;
use kartik\builder\Form;
echo Html::beginForm('', '', ['class'=>'form-horizontal']);
echo Form::widget([
    // formName is mandatory for non active forms
    // you can get all attributes in your controller 
    // using $_POST['kvform']
    'formName'=>'kvform',
    
    // set to static only
    'staticOnly'=>true,
    
    // default grid columns
    'columns'=>2,
    
    // set global attribute defaults
    'attributeDefaults'=>[
        'type'=>Form::INPUT_TEXT,
        'labelOptions'=>['class'=>'col-md-3'], 
        'inputContainer'=>['class'=>'col-md-9'], 
        'container'=>['class'=>'form-group'],
    ],
    
    'attributes'=>[
        'fld1'=>['label'=>'Name', 'value'=>'Kartik'],
        'fld2'=>['label'=>'Email', 'value'=>'info@solutions.com'],
        'fld3'=>['label'=>'From Date', 'staticValue'=>'<em>(not set)</em>', 'type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\DatePicker'],
        'fld4'=>['label'=>'To Date', 'staticValue'=>'<em>(not set)</em>', 'type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\DatePicker'],
        'fld5'=>['label'=>'Details', 'staticValue'=>'<em>(not set)</em>', 'type'=>Form::INPUT_TEXTAREA],
        'fld6'=>['label'=>'Remarks', 'staticValue'=>'<em>(not set)</em>', 'type'=>Form::INPUT_TEXTAREA],
    ]
]);
echo Html::endForm();
Scenario 7 Output

Kartik

info@solutions.com

(not set)

(not set)

(not set)

(not set)