Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid populating Select2 input with existing option #626

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

Toshakins
Copy link
Contributor

Resolves #622.

After searching through the Select2 docs, I've found that pre-population can be avoided by adding a multiple attribute: https://select2.org/getting-started/basic-usage#multi-select-boxes-pillbox

I confirm the update fixes the linked issue.

Again, huge thanks to @aminalaee for his work and research on the clues to resolve the issue.

Still, I am not sure about the next stuff:

  • Should I add some tests, and if yes, where and how?
  • Can my change break somebody's setup?

@Toshakins Toshakins changed the title Avoid populating Select2 input with existing options Avoid populating Select2 input with existing option Sep 21, 2023
@aminalaee
Copy link
Owner

I've tested it in different cases and seems to work in all cases. and also this Select2 widget is only used in ARRAY fields so the impact is limited.

Copy link
Owner

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the PR.

@aminalaee aminalaee merged commit fb58a4e into aminalaee:main Sep 22, 2023
6 checks passed
@aminalaee aminalaee mentioned this pull request Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tag field is pre-populated with an unrelated value
2 participants