changeset 361:8a3991b5c200

Only hide save buttons if there are no fields which should be ignore while setting the field to readonly.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 15 Aug 2013 14:05:08 +0200
parents 302db31ac50a
children 6a7a9267e00f
files app/view/widgets/LadaForm.js
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/widgets/LadaForm.js	Thu Aug 15 14:04:25 2013 +0200
+++ b/app/view/widgets/LadaForm.js	Thu Aug 15 14:05:08 2013 +0200
@@ -142,7 +142,6 @@
      * @param {Array} [ignoreFields="[]"] A list of fieldnames to ignore.
      */
     setReadOnly: function (bReadOnly, ignoreFields) {
-        console.log(ignoreFields);
         if(typeof(ignoreFields)==='undefined') {
             ignoreFields = Array();
         }
@@ -167,14 +166,19 @@
             for (var i = childs.length - 1; i >= 0; i--){
                 childs[i].setVisible(false);
             }
-            /* Find Save-Button and hide it */
-            var win = this.up('window');
-            var buttons = win.query('.button');
-            for (var j = buttons.length - 1; j >= 0; j--){
-                if (buttons[j].text === 'Speichern') {
-                    buttons[j].setVisible(false);
+            /*
+             * Find Save-Button and hide it. Only hide it if there are not
+             * fields left in the form which are editable
+             * */
+            if (ignoreFields.length == 0) {
+                var win = this.up('window');
+                var buttons = win.query('.button');
+                for (var j = buttons.length - 1; j >= 0; j--){
+                    if (buttons[j].text === 'Speichern') {
+                        buttons[j].setVisible(false);
+                    };
                 };
-            };
+            }
         }
     },
     parseResponse: function(response) {

http://lada.wald.intevation.org