Skip to content

When using tags, searched value appears as option and prevents Select-All #347

@datenfalke

Description

@datenfalke

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of yii2-widget-select2.
  • This is not an usage question. I confirm having read the widget documentation and demos.
  • This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • This is not a source plugin (select2) issue. (Those should be directed to the plugin issues repo).
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

Steps to reproduce the issue

  1. Open https://demos.krajee.com/widget-details/select2#usage-tags
  2. Enter "a" into first Select2 box
  3. click "Select all"

Expected behavior and actual behavior

Expected would be the selection of all found options.

No options are selected, and a JS error appears regarding the missing attr of the entered value "a", see screenshot.

The entered value should not be part of the inserted options when clicking "Select all".

If you enter no search value and click "Select all" it is working because no search value produces the error.

How can I prevent the insertion of the searched value into the list of options?

Isolating the problem

Screenshot_20220316_135144

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions