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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeforeRemoveTag fails if combined with single-value mode #1113

Closed
3 tasks done
Massi-X opened this issue Sep 2, 2022 · 1 comment
Closed
3 tasks done

BeforeRemoveTag fails if combined with single-value mode #1113

Massi-X opened this issue Sep 2, 2022 · 1 comment

Comments

@Massi-X
Copy link

Massi-X commented Sep 2, 2022

``## Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

馃挜 Demo Page

https://jsbin.com/jozesasopa/edit?js,console,output

Explanation

When in single-value mode (or select if you prefer) with enforceWhitelist=true I would like to avoid to have the ability to leave the input empty; it should always be set to some value (like a real select).
Because I don't see any other way I used an hook to reject the deletion, it does work fine but the text is deleted anyway no matter what.

There should be a fix for this or even better when in this mode a value should always be required to avoid leaving the input empty (and so avoid backspace and remove the 'x' button).

EDIT: To point out why it works fine, I see that by sending the form the value is indeed there and not deleted.
EDIT 2: Just to add another thing, a workaround is to use

callbacks: {
	remove : (e) => {
		e.detail.tagify.addTags(e.detail.data.value);
	}
}
@yairEO yairEO closed this as completed in 3d50e58 Sep 3, 2022
@yairEO
Copy link
Owner

yairEO commented Sep 3, 2022

Here you go:

https://jsbin.com/gikokox/1/edit?html,css,js,output

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

No branches or pull requests

2 participants