Commit 7775c2dc authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Formultor: add input_type parameter in TextWidget.

parent 27052298
...@@ -325,7 +325,7 @@ class TextWidget(Widget): ...@@ -325,7 +325,7 @@ class TextWidget(Widget):
"""Text widget """Text widget
""" """
property_names = Widget.property_names +\ property_names = Widget.property_names +\
['display_width', 'display_maxwidth', 'extra'] ['display_width', 'display_maxwidth', 'input_type', 'extra']
default = fields.StringField('default', default = fields.StringField('default',
title='Default', title='Default',
...@@ -352,13 +352,23 @@ class TextWidget(Widget): ...@@ -352,13 +352,23 @@ class TextWidget(Widget):
default="", default="",
required=0) required=0)
input_type = fields.StringField('input_type',
title='Input type',
description=(
"The type of the input field like 'color', 'date', 'email' etc."
"Note input types, not supported by old web browsers, will behave "
"as input type text."),
default="text",
required=0)
def render(self, field, key, value, REQUEST, render_prefix=None): def render(self, field, key, value, REQUEST, render_prefix=None):
"""Render text input field. """Render text input field.
""" """
display_maxwidth = field.get_value('display_maxwidth') or 0 display_maxwidth = field.get_value('display_maxwidth') or 0
input_type = field.get_value('input_type') or 'text'
if display_maxwidth > 0: if display_maxwidth > 0:
return render_element("input", return render_element("input",
type="text", type=input_type,
name=key, name=key,
css_class=field.get_value('css_class'), css_class=field.get_value('css_class'),
value=value, value=value,
...@@ -367,7 +377,7 @@ class TextWidget(Widget): ...@@ -367,7 +377,7 @@ class TextWidget(Widget):
extra=field.get_value('extra')) extra=field.get_value('extra'))
else: else:
return render_element("input", return render_element("input",
type="text", type=input_type,
name=key, name=key,
css_class=field.get_value('css_class'), css_class=field.get_value('css_class'),
value=value, value=value,
......
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