Problem/Motivation
When using the synonyms-enabled autocomplete field, if a tag is typed in and not matched via the dropdown list it assigns the first tag found alphabetically in the list, instead of failing with a message indicating an unknown item was entered.
Steps to reproduce
Configure a tag field to use the synonyms autocomplete field.
Make sure the "Create referenced entities if they don't already exist" option is enabled on the field.
Create a piece of content that shows the autocomplete field.
In the field, fill in a value that doesn't exist in the source, and don't select an item in the autocomplete field.
Click "Save".
What happens:
* The first possible match in the source will be added to the field.
What should happen:
* An error is shown indicating that an unknown value was entered in the field.
Proposed resolution
Fix the autocomplete field so it does not save unwanted values.
Remaining tasks
Fix the bug =)
User interface changes
The synonyms-autocomplete widget works
API changes
TBD
Data model changes
n/a
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | synonyms-n3377834-7.patch | 5.29 KB | damienmckenna |
Comments
Comment #2
damienmckennaAm working on this.
Comment #3
damienmckennaWe'll need the changes from #3201107 for the test coverage.
Comment #4
devad commentedIt would be nice to have the common free-tagging feature. The current synonyms autocomplete widget does not have it.
It is worth mentioning here that the "Create referenced entities if they don't already exist" option is never tested together with synionyms-friendly autocomplete field since it was not supposed to work. It is possible that some other errors and issues can arise as well if this option is enabled.
Comment #5
damienmckennaAnother bug I ran into: #3377858: Query accessCheck() error when using D10
Comment #6
devad commentedI have updated the documentation. Free-tagging warning is included now:
https://www.drupal.org/docs/contributed-modules/synonyms/submodule-synonyms-autocomplete
Comment #7
damienmckennaThis will cause a validation error if one of the values was not found.
Comment #8
damienmckennaComment #9
damienmckennaTests-only.
Comment #11
damienmckennaThe tests on their own fail, while the full patch passes as expected.
Comment #12
damienmckennaComment #14
devad commentedI tested and it works as expected for me. Committed to dev.
Note: The only change I have made before commit is that I have changed the validation Error message from:
'One of the items entered could not be found.'to:'At least one of the items entered could not be found.'It is more general.Thanks @DamienMcKenna.
Comment #15
devad commentedComment #16
damienmckennaThank you!