jquery-tokeninput
jquery-tokeninput copied to clipboard
Allow creation of tokens on the fly
+1
+1 This truly is the feature missing from tokenInput.
I had some UX epiphanies while adding this patch to my project though. In my particular application I at least prefer the custom token to be at the top instead of the bottom, so I added an option for that. And, in case there already is exists a proper token with the exact same name as the user input, no need to display a custom token. I put them in a gist, if you're interested; https://gist.github.com/1492593
+1
@groenroos it'd be nice to have your improvements in there - but it's a little hard to get a diff via a gist. Could you perhaps fork my fork (now that sounds weird) and add your changes on top? Then I could pull them in (and eventually @loopj can then pull the whole thing in)
https://github.com/groenroos/jquery-tokeninput
Interesting, we were working on the same thing at the same time!
I like how your patch uses an onCreate callback function rather than assuming that creation is going to be handled by an ajax call. This allows one to implement more validation in the middle or even store tokens in localStorage.
Thanks @ches for the comments, I added your comments to the pull request
Any possible chance to make it so the 'onCreate' callback is only called if you select the token i.e. press 'enter' when '(Create new Token) is showing, right now it fires at every result .
EDIT: Nevermind, I see that you added a 'wasCreated' property to the onAdd method. Good work
+1
+1