summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-08-30 07:19:35 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-08-30 07:19:35 +0000
commita7159a98674c6a966c132b3b875f8124b9ceb1b8 (patch)
tree2ecb2a4e280dba6516626cb8d02e100efcfc74d4
parentc60a1043cab3743be59e370d83823064e9c21616 (diff)
- lock_form(): fix hidden fields were disabled because of wrong type check
- lock_form(): fix initially disabled fields shouldn't be enabled on unlock git-svn-id: https://svn.roundcube.net/trunk@3919 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/js/app.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js
index 97c5791f7..5385c4936 100644
--- a/roundcubemail/program/js/app.js
+++ b/roundcubemail/program/js/app.js
@@ -5145,19 +5145,28 @@ function rcube_webmail()
}
};
- // set all fields of a form disabled
+ // disable/enable all fields of a form
this.lock_form = function(form, lock)
{
if (!form || !form.elements)
return;
- var type;
- for (var n=0, len=form.elements.length; n<len; n++) {
- type = form.elements[n];
- if (type == 'hidden')
+ var n, len, elm;
+
+ if (lock)
+ this.disabled_form_elements = [];
+
+ for (n=0, len=form.elements.length; n<len; n++) {
+ elm = form.elements[n];
+
+ if (elm.type == 'hidden')
continue;
- form.elements[n].disabled = lock;
+ // remember which elem was disabled before lock
+ if (lock && elm.disabled)
+ this.disabled_form_elements.push(elm);
+ else if (lock || $.inArray(elm, this.disabled_form_elements)<0)
+ elm.disabled = lock;
}
};