tag-it
tag-it copied to clipboard
Added Ability to display label instead of value
Not all use cases involve the Value and Label being the same. This functionality makes it so that 'label' will be displayed, while 'value' will be submitted to the form.
Some if/then statements mean that if no Label is found, the Value is used - as before.
A bug that I discovered is that the ID and not the label will be displayed if a person keys over to the appropriate entry.
Excellent feature !!
Doesn't appear to work when using the down key to select an autocomplete option. that.createTag(that._cleanedInput());
is called without the jquery ui item.
It's ok when I use mouse to select the autocomplete option. But if I use the down key it will display ID instead of label. How to solve this issue??
@n3ISe I've fixed that issue in my fork: https://github.com/jjlharrison/tag-it
Thanks @jjlharrison
+1
You could create a branch with this and refactor later.
@n3ISe To fix the issue with key down you have to implement a function for autocomplete 'focus' property,like this:
$("#myInput").tagit({
autocomplete: {
focus: function (event, ui) {
$(this).val(ui.item.label);
return false;
}
}
});
Also,When tareko's changes are going to be merged into the master repository ?
+1. Would be really nice to add this feature.
If not ready for merge, what is missing? We may perhaps help? :)
Any update on this?
I was able to fix this issue by editing my jquery-ui.js file.
I am using jQuery UI version 1.10.4, it was on line 2267. I needed to change:
if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { this._value( item.value ); }
to
if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { this._value( item.label ); }
+1, started integrating this plugin but realized I can't use it in its current state.
+1