[Svn] r3919 - trunk/roundcubemail/program/js

trac at roundcube.net trac at roundcube.net
Mon Aug 30 09:19:35 CEST 2010


Author: alec
Date: 2010-08-30 02:19:35 -0500 (Mon, 30 Aug 2010)
New Revision: 3919

Modified:
   trunk/roundcubemail/program/js/app.js
Log:
- lock_form(): fix hidden fields were disabled because of wrong type check
- lock_form(): fix initially disabled fields shouldn't be enabled on unlock


Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2010-08-29 07:06:20 UTC (rev 3918)
+++ trunk/roundcubemail/program/js/app.js	2010-08-30 07:19:35 UTC (rev 3919)
@@ -5145,19 +5145,28 @@
     }
   };
 
-  // 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;
     }
   };
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list