summaryrefslogtreecommitdiff
path: root/public_html
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-07-10 12:14:25 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2012-07-10 12:14:25 (GMT)
commit34bfb106f2164400882fabb54e92036bf1466cea (patch)
tree3ad85bfe7f54d78bc4dc99ec97f7b2aa0ee47761 /public_html
parenta4f7bc4e82ca4bc8a3f1bf12e630864876fd0574 (diff)
downloadkolab-wap-34bfb106f2164400882fabb54e92036bf1466cea.tar.gz
Fix maxcount for lists with autocompletion
Diffstat (limited to 'public_html')
-rw-r--r--public_html/js/kolab_admin.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 8859cc4..24dea51 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -853,6 +853,7 @@ function kolab_admin()
span = $(this.parentNode.parentNode),
maxcount = $('textarea[name="'+name+'"]').attr('data-maxcount');
+ // check element count limit
if (maxcount && maxcount <= span.parent().children().length) {
alert(kadm.t('form.maxcount.exceeded'));
return;
@@ -895,11 +896,18 @@ function kolab_admin()
dt = (new Date()).getTime(),
span = $(input.parentNode),
name = input.name.replace(/\[-1\]$/, ''),
- af = kadm.env.assoc_fields;
+ af = kadm.env.assoc_fields,
+ maxcount = $('textarea[name="'+name+'"]').attr('data-maxcount');
// reset autocomplete input
input.value = '';
+ // check element count limit
+ if (maxcount && maxcount <= span.parent().children().length - 1) {
+ alert(kadm.t('form.maxcount.exceeded'));
+ return;
+ }
+
// check if element doesn't exist on the list already
if (!af[name])
af[name] = {};