Hello,

So here is something that may help others, I unbind the keypress event on the target field via hook_form_alter()

    drupal_add_js("jQuery('document').ready(function() { 
      jQuery('.views-widget-filter-field_member_products_services_tid input#autocomplete-deluxe-input').unbind('keypress'); });", array('type' => 'inline'));

This causes the keypress event to never fire and stray (undefined) terms are not added to the list. You will notice that passing undefined terms to the filter in a view will throw multiple fatty errors complaining that the term doesn't exist.

Also even with the Content Taxonomy module enabled the client-side GUI doesn't validate and instead the validation occurs after submission of the form.

Maybe a validation settings could be added to the autocomplete_deluxe settings array client-side that checks if it should unbind the keypress event?

Thoughts?

CommentFileSizeAuthor
#1 taxonomy_deny_new_terms-1677390-1.patch3.74 KBhedley

Comments

hedley’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Component: Multiple list - deny new values » Multiple values
Issue summary: View changes
Related issues: +#1796608: Change tip '@term will be added' for fields with Deny any new terms
StatusFileSize
new3.74 KB

I also came across this issue, having "@term will be added" in the GUI, and then allowing the term item to be added to the widget caused some serious usability issues when the user could not add the term.

I've attached a patch here which relies on having the content taxonomy module installed, I expect this will need refactoring to still work without content taxonomy, but it's a start.

The patch adds a check for the 'deny new terms' field setting and then shows the message "@term not found" and does not allow adding the term to the widget.

This should also resolve Change tip '@term will be added' for fields with Deny any new terms and possibly How can I stop the taxonomy widget from allowing users to add new terms.

rajab natshah’s picture

Status: Active » Closed (outdated)