preventDuplicates when allowing custom tags #1

Merged
merged 7 commits into from Oct 23, 2012

Conversation

Projects
None yet
6 participants

martar commented Apr 28, 2012

what happends:
when user are allowed to add custom tags and the tokenValue is set by them (not using default 'id'), preventDuplicates behaviour doesn't work.

why it happens:
hen adding a custom tag, a item[settings.tokenValue] is filled (line 280), but in line 508, where the condition for preventDuplicates is evaluated, it uses item.id instead of item[settings.tokenValue], to compare the values

fix:
martar/jquery-tokeninput@c88c9d8

Owner

mean-cj commented on ecb8b04 Nov 13, 2011

Custom tokenValue , I mean this commit for user can be add new items

still issues. If we use this, then there is errors on resultsFormatter: and tokenFormatter:

item is undefined
http://localhost/xxxxx/

I would suggest tweaking this to use a configuration setting e.g. 'allowAdd'. Based on that value, one could allow addition of new items in some cases and not in others...

Owner

mean-cj replied Nov 21, 2011

Thank you for your suggestion
453094c

Nice. Where is "show_dropdown_warn" used?

Owner

mean-cj replied Nov 23, 2011

"show_dropdown_warn" function not use, you can remove this function
i can't edit last comit -*-

nu111 replied Dec 7, 2011

The original plugin's database oriented,
tockens are objects with an ID and a STRING

(correct me if i'm wrong)
with your solution, whene the user creates a new tocken, it wont have the ID setteded with the id value of the database...
am I write?

@nu111 you may handle this when processing the items within the database of your choise. If id is null, then give them a new one.
If new values are allowed and new values are entered, the values may be prefixed with '[NEW]'.

martar added some commits Apr 27, 2012

@martar martar Merge remote-tracking branch 'origin/patch-1'
Conflicts:
	src/jquery.tokeninput.js
e2b5d23
@martar martar merged patch1 brnach to master 4e0cf2b
@martar martar updated gitignore (project specific files) e10ef40
@martar martar fixing preventDuplicates bevahiour after allowing user to create his …
…custom tags. When adding a custom tag, a item[settings.tokenValue] is filled (line 280), but in line 508, where the condition for preventDuplicates is evaluated, it uses item.id instead of item[settings.tokenValue], to compare the values
c88c9d8
@martar martar When input looses focus, and it contains not yet added tags(for ex no…
… enter/tab was pressed)it should act the same way as it the enter/tab was pressed.

 It prevents from not containing some data entered by the user
 when the form with the input is submitted, if he for example moves from input to input with a mouse not the tab
ac5573b
@martar martar appending to readme 39038cc

@mean-cj mean-cj added a commit that referenced this pull request Oct 23, 2012

@mean-cj mean-cj Merge pull request #1 from martar/master
preventDuplicates when allowing custom tags
2c8d734

@mean-cj mean-cj merged commit 2c8d734 into mean-cj:patch-1 Oct 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment