You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
whereas the "this.persons" is an array of names like [John Carpenter, Michael Bay, ...].
I want to allow the user to input names from this array via autocompletion or input custom tags in the form of email addresses.
Everything seems to work fine with the auto-completion until i enter a custom tag like "[email protected]". After that the auto-completion won't show up again for available tags!
After I remove the custom tag from the widget (by clicking the "x" or back button) the auto-completion works again.
The text was updated successfully, but these errors were encountered:
I did some investigating and found the problem, at least I think so. Inside the _create method in the plugin source there is a code block for the autocompletion:
"if (!this.options.autocomplete.source) { ..."
In this block the search term (filter) is compared against the availableTags resulting in an array (choices) which is passed to the autocomplete widget.
The problem seems to be that within the $.grep loop each available tag aswell as the filter string itself have a leading whitespace! So adding the javascript native trim() to the filter variable, and each element that is compared seems to fix the problem.
Would love to see the plugin source updated with this fix, as I do not like editing the source code locally. Thanks!
I run the plugin with the following options:
availableTags: this.persons,
allowSpaces: true,
singleField: true,
allowDuplicates: false,
singleFieldDelimiter: ',',
tagLimit: null,
whereas the "this.persons" is an array of names like [John Carpenter, Michael Bay, ...].
I want to allow the user to input names from this array via autocompletion or input custom tags in the form of email addresses.
Everything seems to work fine with the auto-completion until i enter a custom tag like "[email protected]". After that the auto-completion won't show up again for available tags!
After I remove the custom tag from the widget (by clicking the "x" or back button) the auto-completion works again.
The text was updated successfully, but these errors were encountered: