[Mpuls-commits] r707 - in waska/trunk: . waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 26 08:46:24 CET 2009


Author: torsten
Date: 2009-11-26 08:46:23 +0100 (Thu, 26 Nov 2009)
New Revision: 707

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/lib/renderer.py
Log:
Fixed rendering disabled fields


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2009-11-25 17:16:38 UTC (rev 706)
+++ waska/trunk/ChangeLog.txt	2009-11-26 07:46:23 UTC (rev 707)
@@ -1,3 +1,8 @@
+2009-11-26 	Torsten Irlaender  <torsten.irlaender at intevation.de>
+
+	* waskaweb/lib/renderer.py: If formfields are disabled. Render
+	  additionale hidden fields to not loose any formdata.
+
 2009-11-25 	Torsten Irlaender  <torsten.irlaender at intevation.de>
 
 	* waskaweb/templates/casemanagement/phase.mako: Fixed check if the cm

Modified: waska/trunk/waskaweb/lib/renderer.py
===================================================================
--- waska/trunk/waskaweb/lib/renderer.py	2009-11-25 17:16:38 UTC (rev 706)
+++ waska/trunk/waskaweb/lib/renderer.py	2009-11-26 07:46:23 UTC (rev 707)
@@ -526,16 +526,19 @@
         else:
             name = ""
 
+        if not size: size = "1"
+
+        out = [ label ]
+
         display_mode = ""
         if self.disabled_mode:
             display_mode = "disabled"
+            # Add hidden field to not loose formdata
+            out.append('<input type="hidden" %s value="%s"' % (name, data))
 
         multiple = multiple and "multiple" or ""
 
-        if not size: size = "1"
 
-        out = [ label ]
-
         if error:
             css_class.append('error_box')
 
@@ -718,6 +721,7 @@
             out.append('<textarea class="%s" %s %s %s %s>%s</textarea><br>\n' % (
             " ".join(css_class), name, rows, cols, SET_MODIFICATION, value))
         else:
+            out.append('<input type="hidden" %s value="%s"' % (name, value))
             value = value.replace('\r\n', '<br>')
             value = value.replace('\n', '<br>')
             value = value.replace('\r', '<br>')
@@ -752,6 +756,7 @@
             display_mode = "readonly"
 
         if self.disabled_mode:
+            out.append('<input type="hidden" %s value="%s"' % (name, data))
             display_mode = "disabled"
 
         if error:
@@ -782,23 +787,24 @@
         if length: length = 'maxlength="%s"' % escape(length, True)
         else:      length = ""
 
+        if name:
+            name = escape(name, True)
+            name = 'name="%s" id="%s"' % (name, name)
+        else:
+            name = ""
+
+        out = [ self._renderLabel(description, name, help=help) ]
+
         display_mode = ""
         if self.ro_mode: 
             if not self.disabled_mode: css_class.append('readonly')
             display_mode = "readonly"
 
         if self.disabled_mode:
+            out.append('<input type="hidden" %s value="%s"' % (name, data))
             display_mode = "disabled"
 
-        out = [ self._renderLabel(description, name, help=help) ]
 
-        if name:
-
-            name = escape(name, True)
-            name = 'name="%s" id="%s"' % (name, name)
-        else:
-            name = ""
-
         if error:
             css_class.append('error_box')
 
@@ -839,16 +845,21 @@
         else:
             id, name = "", ""
 
+        display_mode = ""
         if self.ro_mode: 
-            disabled = "readonly"
-            css_class.append('readonly')
-        else: disabled = ""
+            if not self.disabled_mode: css_class.append('readonly')
+            display_mode = "readonly"
 
+        if self.disabled_mode:
+            out.append('<input type="hidden" %s value="%s"' % (name, data))
+            display_mode = "disabled"
+
+
         if error:
             css_class.append('error_box')
             
         out.append('<input type="text" class="%s" %s %s %s %s %s><br>\n' % (
-            " ".join(css_class), disabled, size, name, value, SET_MODIFICATION))
+            " ".join(css_class), display_mode, size, name, value, SET_MODIFICATION))
 
         self.toTarget(Item("".join(out)), integer.getTarget())
 



More information about the Mpuls-commits mailing list