Commit 992c172a authored by Sebastien Robin's avatar Sebastien Robin

do not dispaly the .0 with integer fields


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1913 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 63de28d7
......@@ -247,6 +247,38 @@ class PatchedLinkWidget(TextWidget) :
PatchedLinkWidgetInstance = PatchedLinkWidget()
LinkField.widget = PatchedLinkWidgetInstance
class IntegerWidget(TextWidget) :
def render(self, field, key, value, REQUEST) :
"""Render link.
"""
LOG('IntegerWidget.render, value',0,repr(value))
LOG('IntegerWidget.render, type(value)',0,type(value))
if type(value) is type(1.0):
value = int(value)
display_maxwidth = field.get_value('display_maxwidth') or 0
if display_maxwidth > 0:
return render_element("input",
type="text",
name=key,
css_class=field.get_value('css_class'),
value=value,
size=field.get_value('display_width'),
maxlength=display_maxwidth,
extra=field.get_value('extra'))
else:
return render_element("input",
type="text",
name=key,
css_class=field.get_value('css_class'),
value=value,
size=field.get_value('display_width'),
extra=field.get_value('extra'))
from Products.Formulator.StandardFields import IntegerField
IntegerFieldWidgetInstance = IntegerWidget()
IntegerField.widget = IntegerFieldWidgetInstance
import string
def StringBaseValidator_validate(self, field, key, REQUEST):
......
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