Download & Extend

Can this restrict certain characters?

Project:Tag Trap
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:alphanumeric, characters, special characters

Issue Summary

One issue I have come upon is the use of special characters in free tagging terms. Specifically, I needed a module that restricted free tags to alphanumeric characters because I use those terms as arguments in Views. User cwgordon07 graciously wrote me a small module called "taxonomy alphanumeric" that does that. It hasn't been committed as a project, so if you want you could add this functionality. Otherwise it can be submitted as a separate module.

Comments

#1

So have functionality where it'd remove the tag if it had one or more non-alphanumeric characters in it, is this correct?

#2

Correct. In my case, I actually altered it slightly to also allow the space character. More broadly, perhaps you could modify tag trap so that it not only rejects specific terms but also characters within terms that the user can choose. So some users may just want to restrict certain special characters, others may want to restrict all uppercase characters (or perhaps have them converted to lowercase). In most cases, I would think that allowing special characters in free-tagging terms is more trouble than its worth. It really complicates the process of using those terms as data.

#3

Okay. This sounds like an interesting idea. Do you have any ideas on how to implement it on the front end? One idea I had was to have a text field where you can enter a regular expression string, save that with the vocabulary and then check the entered terms against the regular expression pattern. You get a match, then form validation fails, otherwise continue.

#4

I think that sounds perfect. Obviously it would need a front-end rather than requiring people to alter the module with their regular expression.

By the way, you may want to look at http://drupal.org/project/validation_api and http://drupal.org/project/validations

#5

I added this functionality as well as some other major and minor changes. This is all in the dev release (download here http://drupal.org/node/394756/release). You'll want to reinstall the module completely because the table schema has change significantly. Tell me of any and all bugs you come across.

nobody click here