alexgorbatchev / jquery-textext

A super awesome, customizable text input supporting tags, autocomplete, ajax and other goodness in a crazy cool a-la cart way.
http://textextjs.com
MIT License
1.27k stars 202 forks source link

Can't manually add tags after using the autocomplete/ suggestions plugin #109

Open yogodoshi opened 11 years ago

yogodoshi commented 11 years ago

Code:

<ul class="js-platforms-examples">
<li>Android</li>
<li>Arcade</li>
<li>Dreamcast</li>
<li>Gamecube</li>
</ul>
$('#js-platforms').focus().textext({
        plugins : 'autocomplete suggestions tags filter',
        suggestions: [
            'Android',
            'Arcade',
            'Dreamcast',
            'Flash',
            'Game Boy',
            'GB Advance',
            'GB Color',
            'Gamecube'
        ]
    });

$(".js-platforms-examples li").click(function(){
      $('#js-platforms').textext()[0].tags().addTags([ $(this).text() ]);
    });

To reproduce the bug:

Load the page, if you click on the list itens, they will be appended correctly to the textarea. But if you type "g", for example, on the textarea, you won't be able to add manually any other tag then those suggestions starting with "g".

It seems that the reason is this line "if(tag && self.isTagAllowed(tag))" of the tags plugin that will then call 'isValueAllowed' on the filter plugin that will populate the 'list' variable with: 'self.opts('filterItems') || self._suggestions || []'.

In this case 'self.opts('filterItems')' is returning only those suggestions starting with 'g' and isnt allowing me to add any other tag manually even though they are listed on the suggestions list.

sneha27 commented 9 years ago

Did you find solution to this?

yogodoshi commented 9 years ago

Sorry but I can't even remember @sneha27 =s