Want to display error message when user inputs a duplicate tag
Prerequisites
- [x] I am running the latest version
- [x] I checked the documentation and found no answer
- [x] I checked to make sure that this issue has not already been filed
Demo Page - clone one of the below:
https://jsbin.com/jekuqap/edit?html,js,output
React issue template: https://codesandbox.io/s/tagify-react-issue-template-4ub1r?file=/src/index.js
https://codepen.io/andyhughes73/pen/WbvjOqJ?editors=1111
Hi,
I am trying to use tagify on my blog project and I've run into a problem trying to get it to do what I need. I am trying to have it so that a user can partially type a tag and it prepopulates for them to choose (that bit works fine).
I want them to also be able to manually type a tag and it get's added to the list of available tags, or not if it's invalid. I think this bit works ok too.
The next step, is that I'd like an invalid (duplicate or spurious code) tag to be caught and show an error to the user. This bit is where I can't get it to work. I think the error is being picked up in the console, but it then shows that the error is cleared. At the front end, the error message never shows up.
For example, I start typing "braki...." and the box pops up for me to choose "braking". On enter, it populates perfectly. I then go to type "braking" and hit comma. At this point, I want it to know that it's a duplicate, which in the background it does. Then as a result, I want it to show an error on the frontend to explain to the user, why the tag is invalid. That's the bit I can't figure out. The error message just never shows up.
I've tried chatgpt, I've added it as a question on Stackoverflow and I've searched on here for something similar but got no joy.
I get that the tagify works perfectly well in stopping the duplicate tag, but I really want the user to know and understand with the error message.
I've produced a codepen (link is above) and I've done an example on Stackoverflow. I'm now hoping you can either help me understand how best to achieve it, or maybe help me figure out why it's not working the way I'd like.
Thanks Andy
Hi Andy!
Can you create a minimal demo with your Tagify setup by closing this jsbin? jsbin.com/jekuqap/edit?html,js,output
BTW, you can add the setting keepInvalidTags: true and the duplicate tags will remain but be painted with a reddish background and will have a tooltip explanation why they appear as such
closing as OP is unresponsive