Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Tags with dots not working. #70

Closed
d-oliveros opened this issue Feb 10, 2014 · 8 comments
Closed

Tags with dots not working. #70

d-oliveros opened this issue Feb 10, 2014 · 8 comments

Comments

@d-oliveros
Copy link

When a tag has a dot in it, the tag is not being added. If that's how it is by design, I think we should have a way to allow dots in tags. I'm building a stackoverflow-like tagging input, and programming terms tend to have dots in them.

Examples:
Node.js, Socket.IO, asp.net, vb.net, .htaccess, etc...

@runxc1
Copy link

runxc1 commented Feb 11, 2014

In addition to tags with dots not working, I am running into an issue where tags with dashes are not working. If I set the setting of converting spaces to dashes I can add the tag as long as it doesn't come from autocomplete.

@runxc1
Copy link

runxc1 commented Feb 11, 2014

So looking at this closer if you set the allowed tags pattern to /^[a-zA-Z0-9\s-.]+$/ you can add a dot and a dash

@mbenford
Copy link
Owner

By default, only alphanumeric characters are allowed. That can be easily changed by setting the allowedTagsPattern to a regular expression that suits one's needs:

<tags-input ng-model="tags" allowed-tags-pattern="^[a-zA-Z0-9\.\-]$" />

This isn't the first time someone asks a question like this one. Even though all available options are documented, I wonder if allowedTagsPattern is a bad name so people keep missing it? What do you guys think?

@d-oliveros
Copy link
Author

Oh, I take the blame on that one for not reading the docs thoroughly. I did look at the options, but probably didn't relate the tag not being added with a configuration issue. At first I thought it was a bug, probably because there's nothing going on when you enter an invalid tag ( Ej. no error classes or else ).

Maybe moving the allowedTagsPattern option higher in the documentation will suffice, that way people that are just getting to know the library will get the option right away. Or if that is not enough, maybe adding a little error / invalid class will make developers know it's like that by design.

Also, I think the autosuggestions shouldn't be displaying strings that do not pass the validation.

This is an awesome directive by the way, good job!

@FoxxMD
Copy link
Contributor

FoxxMD commented Feb 11, 2014

@mbenford I think the documentation is fine -- I think the problem stems from the default pattern not allowing some commonly used characters such as dots and dashes. Perhaps the default pattern should be more liberal and the onus should be on the user to restrict behavior?

@runxc1
Copy link

runxc1 commented Feb 11, 2014

I agree with @FoxxMD the default should be a bit more loose and be something that you can tighten if you need to. I think I was thrown off as I was able to create tags with dashes by using a space and hitting enter and also select them in the typeahead but couldn't figure out why they weren't accepted so I thought something was broke so some minimal feedback of showing that the tag doesn't pass validation would be helpful.

@mbenford
Copy link
Owner

I agree with both suggestions: to make allowedTagsPattern less restrictive and to provide some visual feedback when something is invalid.

Would any of you guys mind creating those issues? I'll appreciate it.

@mbenford
Copy link
Owner

Never mind. Just did it: #76 and #77.

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

No branches or pull requests

4 participants