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

Problem with transformTag and validate #932

Closed
Cagilisto opened this issue Oct 25, 2021 · 3 comments
Closed

Problem with transformTag and validate #932

Cagilisto opened this issue Oct 25, 2021 · 3 comments

Comments

@Cagilisto
Copy link

I'm using tagify to handle a list of phonenumbers input by a user. Some users write phonenumbers with spaces grouping the numbers, and I'm normalizing the numbers by removing spaces. This works fine, but it seems to happen after validation, so the duplication check doesn't match if you write the same number again with spaces.

I couldn't find anything in the documentation or examples on how to solve this. Is there a way to do the transformation before the duplication check?

@yairEO
Copy link
Owner

yairEO commented Oct 25, 2021

Sure, for you anything. Will move the transformation to be called before the validation

@yury-kozlov
Copy link

yury-kozlov commented Apr 24, 2022

@yairEO Seems there's a similar issue happening when I edit a tag:

  1. define handler to remove spaces:
settings.keepInvalidTags = true;
settings.transformTag = (tag) => { tag.value = tag.value.replace(/ +/g, '')};
  1. add some tag, for example: 123
  2. double click on the tag and change it to 1 2 3 (with spaces), press enter
  3. custom handler is invoked (spaces are removed from the tag, value in UI remains the same), but the tag is marked as duplicate ('already exists')
  4. as a result, I can't finish editing the tag unless I change it to some different value or manually remove the spaces

@yairEO
Copy link
Owner

yairEO commented Apr 25, 2022

@yury-kozlov - Thanks, I will in investigate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants