隐藏Kartik DatePicker中的标签部分

时间:2015-04-17 11:56:38

标签: datepicker yii2

我正在尝试从Yii2中的Kartik DatePicker中删除标题部分。我尝试使用以下代码。

    echo \kartik\date\DatePicker::widget([
        'model' => $employmentMod,
        'form' => $form,
        'attribute' => "[$index]emp_date_from",
        'options' => [
            'placeholder' => 'Select date ...', 
            'template' => '{widget}{error}',
            'class' => 'detaildatepicker', 
            ],
        'pluginOptions' => [                
            'todayHighlight' => true,
            'autoclose' => true,
            'format' => 'yyyy-mm-dd',
        ]
    ]);

它仍然无效。我传递了$ form,因为我需要显示验证错误。有人能告诉我如何在这里使用模板吗?

1 个答案:

答案 0 :(得分:0)

为此窗口小部件添加type选项以指定组件的标记:

echo \kartik\date\DatePicker::widget([
        'model' => $employmentMod,
        'form' => $form,
        'attribute' => "[$index]emp_date_from",
        'options' => [
            'placeholder' => 'Select date ...', 
            'template' => '{widget}{error}',
            'class' => 'detaildatepicker', 
            ],
        'type'=> \kartik\date\DatePicker::TYPE_INPUT,
        'pluginOptions' => [                
            'todayHighlight' => true,
            'autoclose' => true,
            'format' => 'yyyy-mm-dd',
        ]
    ]);
相关问题