diff --git a/src/formrender.py b/src/formrender.py
index abe0eab..0fc0f3e 100644
--- a/src/formrender.py
+++ b/src/formrender.py
@@ -49,8 +49,8 @@ class FormRender(object):
u'name="{name}" value="{value}" class="{classes}" '
u'style="{style}" />',
"text": u'',
+ u'cols="{cols}" minlength="{minlen}" maxlength="{maxlen}" '
+ u'style="{style}" class="{classes}">{value}',
"radio_option": u'{label}
',
@@ -175,8 +175,8 @@ class FormRender(object):
return tpl.format(name=name, value=value, minlen=minlen,
required=required, classes=classes, style=style)
- def r_field_text(self, name, value, rows=4, cols=80, required=False,
- classes=None, style=""):
+ def r_field_text(self, name, value, rows=4, cols=80, minlen=None,
+ maxlen=None, required=False, classes=None, style=""):
"""
Render a text field to HTML.
"""
@@ -184,7 +184,8 @@ class FormRender(object):
classes = []
tpl = self.field_tpl['text']
return tpl.format(name=name, value=value, rows=rows, cols=cols,
- required=required, classes=classes, style=style)
+ minlen=minlen, maxlen=maxlen, required=required,
+ classes=classes, style=style)
def r_field_radio(self, name, value, options, classes=None, style=""):
"""
diff --git a/src/webapp.py b/src/webapp.py
index 972c4a9..e797102 100644
--- a/src/webapp.py
+++ b/src/webapp.py
@@ -381,10 +381,10 @@ class ScriptFormWebApp(WebAppHandler):
if field['type'] == 'string':
params['size'] = field.get('size', '')
- if field['type'] in ('string', 'password'):
+ if field['type'] in ('string', 'password', 'text'):
params['minlen'] = field.get('minlen', '')
- if field['type'] in ('string'):
+ if field['type'] in ('string', 'text'):
params['maxlen'] = field.get('maxlen', '')
if field['type'] in ('number', 'integer', 'float'):