It would be good to add an option to the autocomplete_deluxe_taxonomy widget to stop users from adding new terms,
so that if it is enabled users can only select from existing terms (so it isn't acting like free text tags).

Comments

rooby’s picture

Title: Add an option to the autocomplete_deluxe_taxonomy widget to stop users from adding new terms » How can I stop the taxonomy widget from allowing users to add new terms
Category: feature » support
Status: Active » Fixed

This functionality is provided by the content taxonomy module, which will happily work along side this module.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

alanom’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Component: Code » Single values
Category: support » bug
Status: Closed (fixed) » Active

This is broken in 7.x-2.x - it no longer respects the setting set in Content Taxonomy. Keeps flagging up the create new term message even though 'Deny new terms' is set.

Relying on an external module for something as simple as this seems like needless fragility. It's easy to turn off the new terms feature - just add a condition to...

      if ($.isEmptyObject(result)) {
        result.push({
          label: Drupal.t("The term '@term' will be added.", {'@term' : term}),
          value: term,
          newTerm: true
        });
      }

...to not do its thing if some setting is true, then add a checkbox to the field instance form.

I'm hacking around this by just commenting that block of code out, since I want to never enable this feature. Works for me. Another simple sticky-plaster hack would be to add a class like 'no-new-terms' to something containing the fields you want it disabled on, and change the condition to something like this:

if ($.isEmptyObject(result) && !(this.jqObject.closest('.no-new-terms').length) ) {

sepgil’s picture

Status: Active » Closed (won't fix)

Its not broken, its not supported any more. Please use Chosen for that use case.

rooby’s picture

Status: Closed (won't fix) » Active

What is the reason from dropping it from this module if it was already working? Or was it not working anymore?

Seems annoying to have to use two modules that quite probably don't look exactly the same to the end user. Or does the chosen module do everything that this module does? In which case why use this module?

sepgil’s picture

The feature didn't work to well and caused a lot of annoying problems. That's because having an autocomplete field and having a list are two completely different use cases. In the first you want to have a text field that request the terms from the server and updates the list. The second use, which is denying new terms, you want to actually have a search-able select list, which is what chosen does. It simply converts select lists to search javascript widgets. And it does that by far more efficient then autocomplete deluxe ever did. That also meant, that it doesn't allow you to enter new terms, so that's why this module still exists.
Btw: The new autocomplete deluxe multiple widget does look like chosen, but there are some minor differences in the appearance, so that users now when they are allowed to enter new terms and when not.

rooby’s picture

Status: Active » Closed (won't fix)

Sounds good. Thanks for the explanation.

alanom’s picture

The problem is, Chosen has a bunch of issues of its own, and doesn't work too well in cases where there are large numbers of options and large numbers of fields on a page. The amount of markup and javascript processing on each behaviour gets huge and the page starts to creak. I'd vote to have the option of using autocomplete for cases like this. Though Chosen (if it had no bugs) would be better in simple cases.

What issues would there be with something like what I suggested - just not processing the non-matched strings and not moving them into the input?

sepgil’s picture

Large lists of options is the reason why my collegues and I decided to switch to the to chosen. It has much better performance than autocomplete deluxe 1.x had.
just not processing the entered values isn't enough, there also has to be some sort of feedback for the user. I'm sure there also other implications.
I think we should try to improve chosen instead...

LNakamura’s picture

Issue summary: View changes

With respect to #3, Content Taxonomy does work with the current 2.x dev version of Autocomplete Deluxe...

patoshi’s picture

can confirm its working. content taxonomy module to fix this.