0

我正在使用 getbootstrap typeahead 来填充输入值。我已经设置了所有内容,以便用户必须从这个列表中选择一些东西:

<input type="text" class="form-control" id="birdname" ng-model="birdname" required ng-disabled="checked" autocomplete="off" placeholder="Check the box if you don't know!" 
                uib-typeahead="bird for bird in birds | filter:$viewValue | limitTo:8" typeahead-no-results="noResults"
                uib-tooltip="Pick a bird or check the box if unsure!"
                tooltip-placement="top-right"
                tooltip-trigger="mouseenter"
                tooltip-enable="!birdname">
        </div>
        <div ng-show="noResults">
          <i class="glyphicon glyphicon-remove"></i> No Results Found - Please Try Again!
        </div>

正如你所看到的,用户必须从这个列表中选择一些东西,否则验证将不允许它,尽管我遇到了一个问题:如果用户开始输入并且正在输入一个存在的鸟名(输入时显示有鸟的列表) ,但随后用鼠标点击了输入。即使没有选择全名,typeahead 也接受它作为“正确”。

有解决办法吗?

如果你不明白我的意思,下面的图片应该可以解释它:

错误

有针对这个的解决方法吗?例如,它在单击时选择列表中的第一个选项?

4

0 回答 0