13

I have a "term reference" field, in a form that uses an auto-complete widget. I want to limit user input to terms in the vocabulary only, and output a message when a user tries to enter a non existing term.

I found the Content taxonomy module. However this does not work with forms that contain a field collection or a field group.

There is also a contributed patch 1078878-DisableAutoCreation-D7-UTF-8.patch. But I was wondering whether there was a simpler/cleaner solution like a module or maybe I missed an already existing way of doing it with latest drupal and taxonomy versions.

4

There seem to be two possible solutions which are mentioned here http://fooninja.net/2012/08/03/drupal-autocomplete-term-widget-disable-creation/ and you have also mentioned them in your question.

Excerpt from the post,

There are in fact two solutions. One is the Content Taxonomy module. However, I didn’t feel like installing yet another module for such a simple thing. The second solution is patching the core taxonomy module:

A kind soul on the Drupal forum, j.stuyts, posted a small patch that adds an option to disallow autocreation. All you need to do is download the patch (1078878-DisableAutoCreation-D7-UTF-8.patch) to the Drupal 7 root directory and run.

If you then go to Structure » Content types » [Your content type] and edit a Term reference field that uses the Autocomplete term widget, you’ll see a new option at the bottom: “Allow autocreation of new terms” (checked by default).

Although hacking in core is never recommended but you can use patch till the time you get better solution.

  • Hello. The link you provided may answer the question, but if the linked site goes down, your answer will get worthless. Could you post a real answer, not just a link to one? – Mołot Nov 7 '13 at 8:08
  • Thanks for the suggestion @Molot. I have added the excerpt from the post in my answer. – amitgoyal Nov 7 '13 at 8:25
1

There is already an issue created about the problem with field collection module, and it should have been fixed in dev version of the Content Taxonomy module. Please try the latest dev version and if the problem persists, you can re-open and follow the issue at: http://drupal.org/node/1320976

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.