}
setupAttributes();
var cache = {};
- var memberNames = [
- { label: 'Steve', value: 1 },
- { label: 'George', value: 2 },
- { label: 'Dave', value: 3 },
- { label: 'Banner', value: 4 }
- ];
$('#shortcode-members').autocomplete({
minLength: 2,
source: function( request, response ){
var type = 'members';
let record = {id: ui.item.value, name: ui.item.label, type: 'members'};
$('#shortcode-members').val('');
- shortcodeAttributes['members'].list.push(record);
- updateShortcode({list: shortcodeAttributes[type].list, type: type, isList: shortcodeAttributes[type].isList});
+ if ( !checkDuplicates( record, shortcodeAttributes[type].list ) ) {
+ shortcodeAttributes['members'].list.push(record);
+ updateShortcode({list: shortcodeAttributes[type].list, type: type, isList: shortcodeAttributes[type].isList});
+ }
},
close: function( event, ui ) {
$('#shortcode-members').val('');