Commit 6babc8d4 authored by Nicolas Delaby's avatar Nicolas Delaby

Render checkboxes as a disabled checkbox instead return 0 or 1 in view mode

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18242 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3202ce7b
......@@ -303,6 +303,25 @@ def CheckBoxWidget_render(self, field, key, value, REQUEST):
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
from Products.Formulator.StandardFields import LinkField
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment