diff options
author | Georg Ehrke <dev@georgswebsite.de> | 2012-06-30 12:50:26 +0200 |
---|---|---|
committer | Georg Ehrke <dev@georgswebsite.de> | 2012-06-30 12:50:26 +0200 |
commit | 433d15d309b0bade290f028b1365eff77f8dd0a8 (patch) | |
tree | 1fa3ddc8279091c4c2fa34c45a1bfb19f60568d4 /core | |
parent | 34d4eb8edd4b485f65e50fbd4c66f852268f1dab (diff) | |
parent | 6e6f90a8a242c96cc90a5ba35248f7abdfddd6b4 (diff) | |
download | nextcloud-server-433d15d309b0bade290f028b1365eff77f8dd0a8.tar.gz nextcloud-server-433d15d309b0bade290f028b1365eff77f8dd0a8.zip |
Merge branch 'master' into calendar_import
Diffstat (limited to 'core')
-rw-r--r-- | core/js/multiselect.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/core/js/multiselect.js b/core/js/multiselect.js index db5afa637c9..c4fd74b0475 100644 --- a/core/js/multiselect.js +++ b/core/js/multiselect.js @@ -35,6 +35,7 @@ } button.click(function(event){ + var button=$(this); if(button.parent().children('ul').length>0){ button.parent().children('ul').slideUp(400,function(){ @@ -128,19 +129,30 @@ if(event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); + var value = $(this).val(); + var exists = false; + $.each(options,function(index, item) { + if ($(item).val() == value) { + exists = true; + return false; + } + }); + if (exists) { + return false; + } var li=$(this).parent(); $(this).remove(); li.text('+ '+settings.createText); li.before(createItem(this)); var select=button.parent().next(); var option=$('<option selected="selected"/>'); - option.attr('value',$(this).val()); + option.attr('value',value); option.text($(this).val()); - select.append(options); + select.append(option); li.prev().children('input').trigger('click'); button.parent().data('preventHide',false); if(settings.createCallback){ - settings.createCallback(); + settings.createCallback($(this).val()); } } }); |