隐藏Yii2 DatePicker小部件中的历史下拉列表选定值

时间:2018-06-05 02:59:38

标签: yii2 jquery-select2 kartik-v

enter image description here

如何隐藏Yii2 kartik select2中的历史记录下拉列表? 这是我的源代码:

<div class="col-sm-offset-2 col-sm-10" style="margin-left:135px;margin-bottom:15px">
<label class="control-label">Range Perjalanan Dinas</label>
    <?= DatePicker::widget([
    'type' => DatePicker::TYPE_RANGE,
    'model' => $model,
    'attribute' => 'tgl_mulai',
    'attribute2' => 'tgl_selesai',
    'options' => ['placeholder' => 'Start date'],
    'options2' => ['placeholder' => 'End date'],

    'form' => $form,
    'pluginOptions' => [
        'format' => 'dd-mm-yyyy',
        'autoclose' => true,
    ]
]); ?>
</div>

2 个答案:

答案 0 :(得分:3)

在日期选择器选项中尝试'autocomplete' => 'off'

<?= DatePicker::widget([
        'type' => DatePicker::TYPE_RANGE,
        'model' => $model,
        'attribute' => 'tgl_mulai',
        'attribute2' => 'tgl_selesai',
        'options' => ['placeholder' => 'Start date','autocomplete' => 'off'],
        'options2' => ['placeholder' => 'End date'],

        'form' => $form,
        'pluginOptions' => [
            'format' => 'dd-mm-yyyy',
            'autoclose' => true,
        ]
    ]); ?>

答案 1 :(得分:-1)

您可能必须关闭表单元素中的自动填充功能

Turning off form autocomplete