summaryrefslogtreecommitdiff
path: root/public_html/js
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-07-10 11:15:04 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2012-07-10 11:15:04 (GMT)
commit38876a59b51c2c6a3c5768108498c149a105b5a4 (patch)
tree70366dfcfdc2edcee8107f4071a36c52f415e433 /public_html/js
parent2f67b72acd056525bbd28e9236500c96138379f1 (diff)
downloadkolab-wap-38876a59b51c2c6a3c5768108498c149a105b5a4.tar.gz
Implemented maxcount attribute for list widget
Diffstat (limited to 'public_html/js')
-rw-r--r--public_html/js/kolab_admin.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 3b7e97d..8488132 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -849,14 +849,21 @@ function kolab_admin()
// attach element creation event
if (!ac)
$('span[class="add"]', elem).click(function() {
- var dt = (new Date()).getTime(),
+ var name = data.name.replace(/\[[0-9]+\]$/, ''),
span = $(this.parentNode.parentNode),
- name = data.name.replace(/\[[0-9]+\]$/, ''),
+ maxcount = $('textarea[name="'+name+'"]').attr('data-maxcount');
+
+ if (maxcount && maxcount <= ('input', span).length) {
+ alert(kadm.t('form.maxcount.exceeded'));
+ return;
+ }
+
+ var dt = (new Date()).getTime(),
elem = kadm.form_list_element(form, {name: name}, dt);
+ kadm.ac_stop();
span.after(elem);
$('input', elem).focus();
- kadm.ac_stop();
});
// attach element deletion event