None of the features under 'Autocomplete settings' works. When I use 'Allow new terms and insert them into a separate vocabulary' and select my second vocabulary list, I get an error when add taxonomy terms and save. It does not matter if the terms are new or not. I get the same error- Notice: Undefined index: field_FIELD_NAME in content_taxonomy_autocomplete_validate_deny_new_terms() (line 106...

The new terms are not saved where they are supposed to. Instead of being saved in the chosen vocabulary list, they are saved in the same vocabulary list. Even if they are supposed to be denied they will get saved.

Comments

frank ralf’s picture

I get the same error message when denying creating new terms, even when adding an existing term in an autocomplete field:

Notice: Undefined index: field_ingredient in content_taxonomy_autocomplete_validate_deny_new_terms() (line 106 of ...\sites\all\modules\contrib\content_taxonomy\content_taxonomy_autocomplete.module).

EDIT:
The culprit seems to be the field-group we created to structure the form. The module doesn't seem to take this deeper nesting into account.

frank ralf’s picture

StatusFileSize
new13.57 KB

Here's a screenshot to illustrate the problem. The function is looking for field_ingredient only at the top level of form_state:

foreach ($form_state['values'][$field_name][$element['#language']] as $delta => $value) {
...
}

Content Taxonomy field error.png

frank ralf’s picture

Function drupal_array_get_nested_value() might be a solution, see drupal_validate_form() for an implementation example.

yesct’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
StatusFileSize
new55.31 KB

Steps I did. Note this is just testing deny new terms. Seems to work.

  1. 7.x from git
  2. content taxonomy 7.x-1.x from git
  3. install
  4. enable Content Taxonomy Autocomplete under Modules
  5. create an article (Title: One Something, tag: one, body: anything). save. ok.
  6. create another article (Title: Two Something, tag: on does autocomplete as one, body: anything). save. ok.
  7. create another article (Title: Red Something, tag: color, body: anything). save. ok.
  8. go to Manage fields in Administration » Structure » Content types » Article admin/structure/types/manage/article/fields
  9. "edit" the Tags field
  10. change Autocomplete setting to "Deny any new terms" and save
  11. create an article (Title: Three Something, tag: on does autocomplete as one, body: anything). save. ok.
  12. create an article (Title: Bird Something, tag: animal, body: anything). save.
  13. get warning "Tags: new terms are not allowed. Please choose from the given list."

deny-s01-new_term_not_allowed_warning-2012-12-05_1935.png

I'll try "Allow new terms and insert them into a separate vocabulary" next.

yesct’s picture

[edit: add for clarity] This is testing the "Allow new terms and insert them into a separate vocabulary" setting. Seems to work.

Continuing from the previous steps.

  1. Add a "New Tags" vocabulary in Administration » Structure >> Taxonomy admin/structure/taxonomy/add
  2. list terms in New Tags and see there are no terms admin/structure/taxonomy/new_tags
  3. list terms in Tags and see there are two (one, color) admin/structure/taxonomy/tags
  4. edit the tags field for articles again Administration » Structure » Content types » Article » Manage fields admin/structure/types/manage/article/fields/field_tags
  5. change Autocomplete settings to "Allow new terms and insert them into a separate vocabulary". save settings.
  6. follow the directions to "If option 2 is selected, re-save this settings form and afterwards select a second vocabulary for new terms in the field settings. In case the Autocomplete Deluxe widget is used, new terms can be hidden from the suggestion list." and edit the tags field for articles again Administration » Structure » Content types » Article » Manage fields admin/structure/types/manage/article/fields/field_tags
  7. scroll down under "TAGS FIELD SETTINGS" and for "Vocabulary for new terms" pick "New Tags" in the drop down. save settings.
  8. create an article (Title: Cat Something, tag: animal, body: anything). save. ok.
  9. list terms in New Tags and see the new term (animal) admin/structure/taxonomy/new_tags ok.
  10. list terms in Tags and see there are two (one, color) admin/structure/taxonomy/tags ok.
  11. create an article (Title: Dog Something, tag: an does autocomplete to animal, body: anything). save. ok.
  12. check things can be created with a autocompleted tag in the original vocab... create an article (Title: Four Something, tag: on does autocomplete to one, body: anything). save. ok.

That setting also seems to be working ok.

frank ralf’s picture

Yes, the module does work when the autocomplete field is part of a normal, unmodified form.

However, if you use for example the Field group module to structure the form the autocomplete form field moves down the form field tree (see screenshot above) and the module doesn't seem to take this deeper nesting into account.

yesct’s picture

Continuing from the steps in #5, testing with field group module as mentioned in #6. This still seems to work.

  1. (to make testing easier, optional) set Basic page to be promoted to frontpage in Administration » Structure » Content types, "edit" Basic page, admin/structure/types/manage/page and check "Promoted to front page" under Publishing options vertical tab. Save.
  2. Field group (field_group) 7.x-1.x from git (I'm using git, because I'm anticipating maybe applying patches, making changes, making new patch. Git's not necessary otherwise.)
  3. ctools 7.x-1.x from git (it's a dependency of field group)
  4. enable Fieldgroup under Modules admin/modules
  5. go to Manage fields tab of Administration » Structure » Content types » Basic page, admin/structure/types/manage/page/fields
  6. add existing field, from the drop down pick term reference for Tags. save. save settings.
  7. (optional) add a new field: Small field, text. save. save field settings. save settings.
  8. add a new group (Label: Subset, Group name: subset, widget: fieldset). save.
  9. drag Small field and Tags under Subset.
  10. initially, try it with the Tags setting "Allow and insert new terms"
  11. create Basic page (Title: A page, Body: anything, in the Subset expanded fieldset: Small field: any words, Tags: letters). Save. ok.
  12. list terms for Tags vocabulary and see 3 (letters is there). admin/structure/taxonomy/tags
  13. now test deny
  14. edit Tags field in the Manage fields tab of Basic page admin/structure/types/manage/page/fields/field_tags
  15. select "Deny any new terms" under Autocomplete settings. Save settings.
  16. create Basic page (Title: Fly page, Body: anything, in the Subset expanded fieldset: Small field: any words, Tags: insect). Save.
  17. get warning: "Tags: new terms are not allowed. Please choose from the given list." and cannot save. works.
  18. now test create in new vocab
  19. edit Tags field in the Manage fields tab of Basic page admin/structure/types/manage/page/fields/field_tags
  20. select "Allow new terms and insert them into a separate vocabulary" under Autocomplete settings. Save settings. (New tags is still configured as the new vocab so don't have to do that again.)
  21. create Basic page (Title: Apple page, Body: anything, in the Subset expanded fieldset: Small field: any words, Tags: fruit). Save. ok.
  22. list terms for Tags vocabulary and see 3 still. admin/structure/taxonomy/tags . ok.
  23. list terms for New Tags vocabulary and see 2, the including the new one fruit. admin/structure/taxonomy/tags . ok.
damienmckenna’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)

Need confirmation that the bug still exists, according to YesCT's debugging above it should work.

renew’s picture

After spending many hours debugging the problem, I can confirm that the bug still exists.
While using field_group module and adding a tags field inside a group, terms are not a saved to the 'New tags' vocabulary. Also manually created field groups (type = fieldset) with tag fields inside are NOT working with 'Allow new terms and insert them into a separate vocabulary'. All new terms are being added to the main tags vocabulary instead of the new tags vocabulary.

damienmckenna’s picture

Status: Postponed (maintainer needs more info) » Active