Skip to content

Commit

Permalink
Duplicate token detection should also work for newly created tokens, …
Browse files Browse the repository at this point in the history
…based on their value
  • Loading branch information
manuelbernhardt committed Nov 23, 2011
1 parent ae74979 commit e3ac7c0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/jquery.tokeninput.js
Expand Up @@ -44,7 +44,6 @@ var DEFAULT_SETTINGS = {

// Callbacks
onResult: null,
onCreate: null,
onAdd: null,
onDelete: null,
onReady: null,
Expand Down Expand Up @@ -494,7 +493,7 @@ $.TokenList = function (input, url_or_data, settings) {
token_list.children().each(function () {
var existing_token = $(this);
var existing_data = $.data(existing_token.get(0), "tokeninput");
if(existing_data && existing_data.id === item.id) {
if(existing_data && (existing_data.id === item.id || item.wasCreated && existing_data.name === item.name)) {
found_existing_token = existing_token;
return false;
}
Expand Down

0 comments on commit e3ac7c0

Please sign in to comment.