Problem/Motivation

This module does not prevent the user from adding a new term with the same name as an existing term. This results in duplicate terms.

The autocomplete term widget(tagging) would result in the existing term being returned rather than the typed term being added as a new one. This behaviour in HS doesn't match standard behaviour in Taxonomy.

Proposed resolution

Add validation to hierarchical_select_ajax() before drupal_process_form() is called.

Remaining tasks

Code.

User interface changes

Addition of error message informing the term already exists or returning the existing term with a message that it already existed.

API changes

None

Data model changes

None

Comments

hmdnawaz created an issue. See original summary.

ikeigenwijs’s picture

This is also a source of frustration for our application.

Gold’s picture

Priority: Major » Normal
Issue summary: View changes

Just tested this and it is feeling like this is a bug. If this was the standard autocomplete term widget the value would be selected rather than created.

The issue is an annoyance, but it doesn't break anything. Updating to Normal.

Asogan’s picture

Hi, I think the actual issue is articulated more clearly in https://www.drupal.org/project/hierarchical_select/issues/2499241 (albeit closed in favour of this issue/case number).

The problem is that nodes that use the SHS widget allows duplicate terms to be created. This in turn has follow on effects such as frustrating the sorting in Views, as a user sorts for a term but not ALL the relevant content is picked up due to the duplicate term.

I have this challenge with my Www.localsauce.biz website (e.g. In the imported products section, there are two nodes with Canola oil but sorting only picks up one node).

To be fair I haven't tried other modules to fix this issue. This is specific to term creation in the node with the SHS widget, not in the admin menu. Recommendations would be great!