[Erp5-report] r18242 - /erp5/trunk/products/ERP5Form/FormulatorPatch.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Dec 11 16:43:55 CET 2007


Author: nicolas
Date: Tue Dec 11 16:43:53 2007
New Revision: 18242

URL: http://svn.erp5.org?rev=18242&view=rev
Log:
Render checkboxes as a disabled checkbox instead return 0 or 1 in view mode

Modified:
    erp5/trunk/products/ERP5Form/FormulatorPatch.py

Modified: erp5/trunk/products/ERP5Form/FormulatorPatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/FormulatorPatch.py?rev=18242&r1=18241&r2=18242&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/FormulatorPatch.py (original)
+++ erp5/trunk/products/ERP5Form/FormulatorPatch.py Tue Dec 11 16:43:53 2007
@@ -302,6 +302,25 @@
   return "".join(rendered)
 
 CheckBoxWidget.render = CheckBoxWidget_render
+
+def CheckBoxWidget_render_view(self, field, value):
+  """Render checkbox in view mode.
+  """
+  if value:
+    return render_element("input",
+                                   type="checkbox",
+                                   css_class=field.get_value('css_class'),
+                                   checked=1,
+                                   extra=field.get_value('extra'),
+                                   disabled='disabled')
+  else:
+    return render_element("input",
+                                   type="checkbox",
+                                   css_class=field.get_value('css_class'),
+                                   extra=field.get_value('extra'),
+                                   disabled='disabled')
+
+CheckBoxWidget.render_view = CheckBoxWidget_render_view
 
 # Patch the render_view of LinkField so that it is clickable in read-only mode.
 from Products.Formulator.Widget import TextWidget




More information about the Erp5-report mailing list