首页 > 解决方案 > Select2 搜索框值张贴在表单提交偶数不匹配

问题描述

问题:

在 select2 搜索框中搜索后按 enter 时,即使搜索值不匹配,文本框也会填充搜索值(并且在表单提交上发布相同)。

搜索期间:

在此处输入图像描述

回车后:

在此处输入图像描述

我正在使用带有剃刀视图的select2 ( select2.full.jsversion )。Select2 4.0.6-rc.1

HTML:

@Html.DropDownListFor(m => m.PartModel.AccountId, Model.PartModel.AccountList, "-- Select --", new { @class = "form-control search select2picker" })

Javascript:

$(document).find('.select2picker').select2({
        tags: true,
});

标签: asp.net-mvcjquery-select2

解决方案


推荐阅读